Beginners and inexperienced programmers often have the following question: “What are algorithms and why are they needed?” Although this concept is slowly disappearing into oblivion, it is still relevant. When creating large commercial projects, it is simply impossible to do without algorithms. And before you start programming, it is better to understand them and only then proceed to practical exercises. Although this concept is associated with the creation of software on a PC, it is quite common in everyday life. This article will give an example of what algorithms are in real life.
In computer science
Now let's find out what algorithms are in computer science and programming. Under this concept lies the order of actions, using which you can easily and simply solve the problem. An example is the calculation of any one formula. To do this, it will be enough to perform the following actions:
- Enter the initial data required for calculations.
- Display the results either on the computer screen or on some othermedia(e.g. paper).
The algorithm in computer science in appearance can be in the following modifications:
- Graphically (as a set of standardized blocks).
- Step by step text description.
In the first case, it consists of standard blocks, the appearance of which is regulated by GOST with serial number 19.701-90. For example, a simple operation here will look like a rectangle, and the selection condition will be a diamond.
Text description is not so visual and therefore is used much less frequently. In appearance, it resembles a regular bulleted list with numbers or letters. According to the structure, a linear description and a branching one are distinguished. The first option is much less common. The difference between them is that in the second case there are branching blocks and the number of calculations to obtain the final result is unknown.
Now let's figure out what algorithms are in real life. When preparing various dishes, the hostess follows the recipe. For example, when cooking pasta, you need to perform the following algorithm of actions:
- Bring water to a boil.
- S alt her.
- Sprinkle pasta.
- On low heat, stirring them, bring to a boil.
- After they are cooked, drain the water.
- Add butter.
- Stir until smooth.
The dish is ready. If you look at it through the eyesprogrammer, then this is an ordinary linear algorithm written in text form. So it is not so rare that this intricate concept occurs in our life. We just use it and don't even know it.
Instead of conclusions
In many areas of human activity, such a thing as an algorithm is used. Computer science is one of them. Moreover, the most famous. A properly drawn up sequence of actions can significantly simplify the process of creating a software product and improve its quality. It's like a business plan when building a plant or factory. When creating simple programs, you can do without it, but when serious software is being developed, you can’t do without it. It can be either generalized or detailed, but in any case it is.