A research about some basic concepts of Algorithms
By: Noé Lozano Mendoza, Jenny Bacab Saavedra & Steffan Obed Canul Berzunza.
In this glossary we are going to describe some basic concepts of programming that could be useful for beginners.
Numeric:
- integers: All kind of whole numbers.
- floats: Numbers with decimal point. Logic:
- boolean: True and False. String and characters: An ordered sequence of letters. Arrangements:
- lists: An ordered sequence of values.
- dictionaries: A sequence of values assigned to key words.
- tuples: An ordered and ummutable sequence of values.
- sets: An unordered collection of unique objects.
Variables: They are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program. Constants: A value that cannot be altered by the program during normal execution, i.e., the value is constant. When associated with an identifier, a constant is said to be “named,” although the terms “constant” and “named constant” are often used interchangeably.
Operators:
- Arithmetic: Addition(+), subtraction(-), multiplication(x), division(/), modulus(%).
- Logic: Logical AND(&&), logical OR(||), logical NOT(!).
- Relationships: Equal(==), not equal(!=), greater than(>), less than(<), greater than or equal(>=), less than or equal(<=).
In computers, an operand is the part of a computer instruction that specifies data that is to be operating on or manipulated and, by extension, the data itself. Basically, a computer instruction describes an operation (add, subtract, and so forth) and the operand or operands on which the operation is to be performed.
Variables: They are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program.
Constant: A value that cannot be altered by the program during normal execution, i.e., the value is constant. When associated with an identifier, a constant is said to be “named,” although the terms “constant” and “named constant” are often used interchangeably.
An expression is a combination of operators, constants and variables. An expression may consist of one or more operands, and zero or more operators to produce a value.
Arithmetic: An expression that results in a numeric value.
Logic: Two arithmetic expressions connected by a relational operator indicating whether an expression is greater than, equal to, or less than the other, or connected by a logical variable, logical constant (true or false), or logical operator.
Concepts: Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output. Algorithms are generally created independent of underlying languages, i.e. an algorithm can be implemented in more than one programming language.
From the data structure point of view, following are some important categories of algorithms
-
Search − Algorithm to search an item in a data structure.
-
Sort − Algorithm to sort items in a certain order.
-
Insert − Algorithm to insert item in a data structure.
-
Update − Algorithm to update an existing item in a data structure.
-
Delete − Algorithm to delete an existing item from a data structure.
Characteristics: Not all procedures can be called an algorithm. An algorithm should have the following characteristics
-
Unambiguous − Algorithm should be clear and unambiguous. Each of its steps (or phases), and their inputs/outputs should be clear and must lead to only one meaning.
-
Input − An algorithm should have 0 or more well-defined inputs.
-
Output − An algorithm should have 1 or more well-defined outputs, and should match the desired output.
-
Finiteness − Algorithms must terminate after a finite number of steps.
-
Feasibility − Should be feasible with the available resources.
-
Independent − An algorithm should have step-by-step directions, which should be independent of any programming code.
Control structures of the algorithm:
-
Selective structures:The selective structures use the comparison and/or logical operators to select a course of action for the program.
-
Repetitive structures: This structure repeats a set of instructions until.
-
Nested structures:Nested structure is nothing but the structure within a structure. One structure can be declared inside another structures as we declare structure members inside a structure. The structure variables can be a normal structure variable or a pointer variable to access the data. You can learn the below concepts in this section.
-
Flow chart: It is a diagram that describes a process, sistem or an informatic algorithm.
Flowcharts employ rectangles, ovals, diamonds, and numerous other shapes to define the type of step, along with connecting arrows that efficient flow and sequence. They can range from simple, hand-drawn diagrams to comprehensive computer-created diagrams that describe multiple steps and paths. -
Pseudocode: The pseudocode is an informal way to do a program very close to the language we will use in the future. It is like a fake language, but in our language.
-
Problem analysis: Is the process of breaking down the problem into its components. The problem should be fully understood.
-
Algorithm design: Design a set of instructions to solve a problem or sub-problem, look for the desired properties and use a finite amount of time and data. Instructions should not be ambiguous.
-
Coding: Starting with a pseudocode, translate each line into the code you are currently using.
-
Compilation and execution: Call the function and give it some sample sets of data. Use this to see if the code returns the derised results.
-
Check: You can write tests to see if the actual output is equal to the desired output. You can also use
console.log
after each variable to check if the values and code are behaving as expected before moving on. -
Debugging: Is the process of identifying and removing errors from computer hardware or software.
-
Maintenance: Is the constant cleaning and update of the code or data of computer hardware or software.
-
Documentation: Is searching for answers trough papers or forums about a problem or a topic you want to learn about.
-What is a variable in computer programming? (2021). Retrieved January 31, 2021, from Launchschool.com website: https://launchschool.com/books/ruby/read/variables
-TechTarget Contributor. (2017). operand. Retrieved January 31, 2021, from WhatIs.com website: https://whatis.techtarget.com/definition/operand
-Kenneth Leroy Busbee, & Braunschweig, D. (2018, December 15). Constants and Variables. Retrieved January 31, 2021, from Rebus.community website: https://press.rebus.community/programmingfundamentals/chapter/constants-and-variables/
-What is an Expression and What are the types of Expressions? - GeeksforGeeks. (2019, August 2). Retrieved January 31, 2021, from GeeksforGeeks website: https://www.geeksforgeeks.org/what-is-an-expression-and-what-are-the-types-of-expressions/
-Arithmetic Expressions. (2021). Retrieved January 31, 2021, from Upenn.edu website: https://www.cis.upenn.edu/~matuszek/General/JavaSyntax/arithmetic-expressions.html
-logical expression. (2019). Retrieved January 31, 2021, from TheFreeDictionary.com website: https://encyclopedia2.thefreedictionary.com/logical+expression
-Data Structures - Algorithms Basics - Tutorialspoint. (2020). Retrieved January 31, 2021, from Tutorialspoint.com website: https://www.tutorialspoint.com/data_structures_algorithms/algorithms_basics.htm
-References Gupta, S. (n.d.). Basics of Operators Tutorials & Notes | Basic Programming. HackerEarth. Retrieved January 30, 2021, from https://www.hackerearth.com/practice/basic-programming/operators/basics-of-operators/tutorial/
-Ren, S. (2019, October 11). Learn about Python 3 data types — numbers and strings. Medium. https://medium.com/@shawnren527/learn-about-python-3-data-types-numbers-and-strings-76c75a917c9b
Chan, V. (2017, August). 10 Steps to Solving a Programming Problem - codeburst. Retrieved February 5, 2021, from Medium website: https://codeburst.io/10-steps-to-solving-a-programming-problem-8a32d1e96d74
imran. (2017, June 5). Retrieved February 5, 2021, from Free Online Computer & I.T Tutorials Step By Step. website: https://www.computertaleem.com/problem-analysis/
. (n.d.). Problem Solving & Algorithm Design. Retrieved from https://www.eecs.yorku.ca/course_archive/2016-17/W/1530/slides/01_Problem_Solving.pdf