Error message

  • Warning: count(): Parameter must be an array or an object that implements Countable in theme_table() (line 1998 of /home/admin/web/
  • Warning: count(): Parameter must be an array or an object that implements Countable in theme_table() (line 2061 of /home/admin/web/
  • Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in menu_set_active_trail() (line 2405 of /home/admin/web/

The concept of algorithm

We all use different algorithms, instructions, rules, recipes, etc. Usually we do it without thinking. For example, opening the door with a key no one's wondering in what order to perform actions. However, to someone (say, younger brother) to teach to open the door, will have to clearly specify the actions themselves, and the order of their execution. For example:

  • To get the key.
  • Insert the key into the keyhole.
  • Turn the key 2 times counterclockwise.

Remove the key. Now imagine that you are invited to visit. Surely you ask in detail and accurately explain how to get. That might look like an explanation:

  • Get out of the house.
  • Turn to the right.
  • Go 2 blocks to the bus stop.
  • Take the bus number 25 runs to the city center.
  • To 3 stops.
  • Get off the bus.

Look at these algorithms. At first glance, they have nothing in common. It's one thing to open a door, another to go on a visit. However, if you look carefully, you can notice a significant similarity between them. First of all, this is a strict procedure. Let's move in the first algorithm the second and third steps:

  • To get the key.
  • Turn the key 2 times counter clockwise.
  • Insert the key into the keyhole.
  • Remove the key.

Of course, you will be able to perform this algorithm. But the door hardly opens. What happens if you swap the fourth and fifth steps in the second algorithm? It will be impossible! So, we have seen that the algorithm not only important set of actions, but also how they are organized, i.e. in what order are executed.

We can now say that an algorithm is an organized sequence of actions. This formulation, of course, cannot be considered a definition of the algorithm. For example, we did not explain what the words "organized" and "action". I have to say absolutely rigorous definition of an algorithm we do not give. The notion of algorithm in computer science is fundamental. The same as are the notions of point, line and plane in geometry, space and time in physics, in chemistry, substances, etc. Therefore, we will not seek to give a comprehensive definition of the algorithm, and we will clarify the meaning of this concept in the following paragraphs.

We still have to repeatedly write the algorithms, so let's agree, highlighting the procedures in the algorithm, record the actions in a column (as in the examples).