4.1. Basic concept of algorithm¶
An algorithm is a set of unambiguous simple instructions. It ends after a finite amount of operations and produces a result from input data. The algorithm is designed to be executed by the processor. If the processor is a computer, then the algorithm is traduced in a programming language (ie. C/C++, Python, Fortran, Java, etc.) and becomes a program.
The developpement of a programm is following different steps and actors.
The analyse step consists on proposing a solution to the problem by writting an algorithm together with a set of verification tests proving the algorithm value.
4.1.1. Simple algorithm example¶
Recipe of a chocolate cake is an algorithm as it includes a list of simple instructions that takes ingredients in input and produces a chocolate cake as result:
Preheat oven at 180°C.
Melt chocolate and butter together.
Whisk 3 eggs.
Add chestnut cream and beat with eggs.
Incorporate melt chocolate.
Bake for 35 min at 180°C.
4.1.2. Flowchart representation of an algorithm¶
Algorithms can be more complex than the preceding recipe. For example it can contains structured instructions. In that case, it can be usefull to represent the algorithm using a flowchart.