An algorithm is composed of a set of operating rules given for a calculation, in a very precise order, the application of which makes it possible to produce a result which will help us to solve a problem.
It can be translated, using a programming language, into an executable program by a computer.
Algorithmic and programming
How will learning algorithms help us to program?
Simply because learning algorithmic means learning to master the logical structure of a computer program. Whatever the programming language; when programming in a language (in C, in Visual Basic, etc.) we must also tackle the problems (syntax, types of instructions), specific to this language.
We must add that programmers, often self-taught, having directly learned to program in a precise language, do not mentally make a clear difference between what comes under the general logical structure of any programming and what comes from the particular language that ‘they learned.
The 3 steps of an algorithm
- The input (the data of the problem concerned)
- The processing
- The output (display results)
The inputs: locate the data essential to solving the problem.
The processing: determine all the stages of the processing to be done and therefore the instructions to develop to achieve the result we are looking for.
The outputs: the result obtained can be displayed on the screen, or printed on paper, or kept in a file.
Fundamental problems in algorithmic
How long will an algorithm take to solve the problem for us?
How much surface does he need?
Are there tasks for which there is no algorithm?
Can we be sure that an algorithm answers the problem for which it was designed?
For a specific problem space, the algorithm, if it ends, will always give proposals for effective solutions.
A variable is an entity that contains information, it has:
- A name
- A value
- A type that characterizes the set of values that the variable can take
All variables are stored in computer memory