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.

_images/program.jpg

Figure 4.1: Main steps of program development

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:

  1. Preheat oven at 180°C.

  2. Melt chocolate and butter together.

  3. Whisk 3 eggs.

  4. Add chestnut cream and beat with eggs.

  5. Incorporate melt chocolate.

  6. 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.

_images/algoLesson.jpg

Figure 4.2: A basic algorithm example with conditional instructions.