Algorithm is called a recipe for completing a specific task. With the algorithms we meet in everyday life at every step, they often do not even realizing it.

In the morning wash teeth following roughly according to the scheme presented below:

- squeeze a small amount of toothpaste on the brush,
- for 2 minutes, brush teeth,
- rinse with water several times a mouth,
- wash the brush under running water.

Then prepare your favorite breakfast scrambled eggs, realizing perfectly well known to us the recipe:

- Apply a little fat in the pan, for example. butter
- light the stove burner,
- attitudes fat frying pan on the burner,
- hammer the pan 3 eggs, shell throw into the trash,
- pour two pinches of salt,
- stirring the contents of the pan wait until it thickens,
- extinguish the torch,
- the contents of the pan, place on a plate and eat.

In a similar way one can describe dozens of activities performed daily, or give their execution algorithms. Each of these provisions tells us how a specific initial state of the system converted to the desired final state (dirty teeth -> clean teeth, raw eggs -> scrambled eggs).

In mathematics and computer science algorithm also called a recipe that tells us how to perform a certain task, achieve a specific goal. At the same time, however, we formulate this provision to certain strict requirements that must be satisfied that it can be called an algorithm:

**The algorithm is structured, a finite sequence of clearly defined action to take in a finite time leads to the solution of the problem.**

An example of a mathematical algorithm to find the absolute value of:

- Load x
- Is x <0?
- If YES: x: = - x (change to a positive sign)
- If NO: do nothing
- Unsubscribe x (absolute value of the loaded)

**Notations algorithm**

Algorithms can present a variety of ways: by descriptive terms in (as we did so far) via the user selected programming language or graphically, using generally accepted symbols. The latter method is very popular, we present the following symbols, which we will use to write algorithms:

Start algorithm. Symbol of the beginning of the algorithm occurs exactly once. It does not come from any arrow, and goes one.

End algorithm. Symbol of the end of the algorithm, as well as the start symbol, must appear in the algorithm once. It does not go any arrow, and there is at least one.

Block input or output of the algorithm. Shows activity data input to the algorithm (e.g.,. Read: x) and the output of the results and messages (e.g., write: y * 5). On the block I / O is linked to exactly one arrow incoming and one outgoing.

Operating theater, comprises the operations performed by the algorithm. The operational blocks are contained all the calculations performed in the execution of the algorithm. Each operating unit has exactly one incoming arrow and exactly one outgoing arrow.

Decision block, otherwise conditional. Inside the block put a condition that can be either true or not. If the condition is met exit the block route described "YES", and when the condition is false follow the path indicated by the arrow further described "NO". To decision block one arrow reaches the input and output onto two arrows ("YES" or "NO").

Once you have learned the symbols for graphic representation of the algorithms we described earlier drawn about the algorithm for finding the absolute value of: