Algorithm: concept, properties, structure and types

Table of contents:

Algorithm: concept, properties, structure and types
Algorithm: concept, properties, structure and types
Anonim

Practically everything in our world is subject to some laws and rules. Modern science does not stand still, thanks to which mankind knows a lot of formulas and algorithms, following which, you can calculate and recreate many actions and structures created by nature, and bring to life the ideas invented by man.

In this article we will analyze the basic concepts of the algorithm.

The history of the emergence of algorithms

Algorithm - a concept that appeared in the XII century. The word "algorithm" itself comes from the Latin interpretation of the name of the famous middle eastern mathematician Muhammad al-Khwarizmi, who wrote the book "On Indian Counting". This book describes how to correctly write natural numbers using Arabic numerals, and describes the algorithm of actions with a column over such numbers.

In the 12th century, the book "On the Indian Account" was translated into Latin, and then this definition appeared.

Interaction of the algorithm with man and machine

Creationalgorithm requires a creative approach, so only a living being can create a new list of sequential actions. But for the execution of existing instructions, it is not necessary to have a fantasy, even soulless technology can handle this.

An excellent example of exactly following a given instruction is an empty microwave oven that continues to operate despite the absence of food inside it.

A subject or an object that does not need to understand the essence of the algorithm is called a formal executor. A person can also become a formal executor, but in the event that one or another action is unprofitable, a thinking executor can do everything in his own way. Therefore, the main performers are computers, microwave ovens, telephones and other equipment. The concept of an algorithm in computer science is of the utmost importance. Each algorithm is compiled with the expectation of a specific subject, taking into account the permissible actions. Those objects to which the subject can apply instructions constitute the environment of the executor.

Practically everything in our world is subject to some laws and rules. Modern science does not stand still, thanks to which mankind knows a lot of formulas and algorithms, following which you can calculate and recreate many actions and creations of nature and bring to life the ideas invented by man. In this article, we will analyze the basic concepts of the algorithm.

What is an algorithm?

Most of the activities that we perform during our lives require the observance of a number of rules. From how much a person has a correct idea of \u200b\u200bitwhat, how and in what sequence he should do, depends on the quality and result of the tasks assigned to him. Since childhood, parents have been trying to develop in their child an algorithm for the main actions, for example: wake up, make the bed, wash and brush your teeth, do exercises, have breakfast, etc., the list that a person does all his life in the morning can also be considered a kind of algorithm.

An algorithm is a concept that refers to a set of instructions that a person needs to follow in order to solve a certain problem.

algorithm concept
algorithm concept

In general, the algorithm has many definitions, several scientists characterize it differently.

If the algorithm used by a person every day is different for everyone, and can change depending on the age and situations in which the performer finds himself, then the set of actions that need to be performed to solve a mathematical problem or to use technology is the same for everyone and always remains the same.

There is a different concept of an algorithm, the types of algorithms also differ - for example, for a person who pursues a goal, and for technology.

In our age of information technology, people daily follow a set of instructions created before them by other people, because technology requires precise execution of a series of actions when used. Therefore, the main task of teachers in schools is to teach children how to use algorithms, quickly grasp and change existing rules in accordance with the current situation. The structure of the algorithm is one of thoseconcepts, which is studied in the lesson of mathematics and computer science in every school.

program algorithm
program algorithm

Basic properties of the algorithm

1. Discreteness (sequence of individual actions) - any algorithm should be represented as a series of simple actions, each of which should begin after the completion of the previous one.

2. Certainty - each action of the algorithm should be so simple and clear that the performer does not have any questions and does not have freedom of action.

3. Efficiency - the description of the algorithm should be clear and complete, so that after the execution of all instructions, the task reaches its logical end.

4. Mass character - the algorithm should be applicable to a whole class of problems, which can be solved only by changing the numbers in the algorithm. Although there is an opinion that the last point does not apply to algorithms, but to all mathematical methods in general.

Often in schools, in order to give children a better understanding of the algorithms, teachers use the example of cooking from a cookbook, making medicine from a prescription, or making a soap-making process based on a master class. However, taking into account the second property of the algorithm, which states that each item of the algorithm must be so clear that it can be performed by absolutely any person and even a machine, we can conclude that any process that requires at least some kind of imagination, the algorithm cannot be named. And cooking and needlework require certain skills and a well-developed imagination.

There are different types of algorithms,but there are three main ones.

Cyclic algorithm

In this type, some items are repeated several times. The list of actions that must be repeated to achieve the goal is called the body of the algorithm.

Iteration of a loop is the execution of all the items included in the body of the loop. Parts of the loop that are constantly executed a certain number of times are called a loop with a fixed number of iterations.

Those parts of the cycle, the frequency of which depends on a number of conditions, are called indeterminate.

The simplest kind of cycle is fixed.

There are two kinds of cyclic algorithms:

  • Loop with precondition. In this case, the body of the loop checks its condition before it is executed.
  • A loop with a postcondition. In a loop with a postcondition, the condition is checked after the end of the loop.
types of algorithms
types of algorithms

Linear types of algorithms

Instructions of such circuits are executed once in the order in which they are presented. For example, the process of making a bed or brushing teeth can be considered a linear algorithm. This type also includes mathematical examples, where there are only addition and subtraction operations.

algorithm structure
algorithm structure

Branching algorithm

There are several options in a branching type, which one will be applied depends on the condition.

Example. Question: "Is it raining?" Answer options: "Yes" or "No". If a"yes" - open the umbrella, if "no" - put the umbrella in the bag.

algorithm models
algorithm models

Auxiliary algorithm

Auxiliary algorithm can be used in other algorithms by specifying only its name.

Terms found in algorithms

The condition is between the words "if" and "then".

For example: if you know English, then press one. In this sentence, the part of the phrase "you know English" will be the condition.

Data is information that carries a certain semantic load and is presented in such a way that it can be transmitted and used for this algorithm.

Algorithmic process - solving a problem according to an algorithm using certain data.

Structure of the algorithm

The algorithm can have a different structure. In order to describe an algorithm, the concept of which also depends on its structure, you can use a number of different ways, for example: verbal, graphic, using a specially developed algorithmic language.

Which method will be used depends on several factors: the complexity of the task, how detailed the process of solving the problem needs to be, etc.

Graphic version of the algorithm

Graphic algorithm - a concept that implies the decomposition of actions that need to be performed to solve a specific problem, according to certain geometric shapes.

Graphic diagrams are not shown randomly. In order for them to be ableto understand any person, flowcharts and Nassi-Schneiderman structograms are most often used.

Also, block diagrams are drawn in accordance with GOST-19701-90 and GOST-19.003-80. Graphic figures used in the algorithm are divided into:

  • Basic. The main images are used to indicate the operations needed to process data when solving a problem.
  • Auxiliary. Auxiliary images are needed to indicate individual, not the most important, elements of solving the problem.

In a graphical algorithm, the geometric shapes used to represent data are called blocks.

All blocks go in sequence "from top to bottom" and "left to right" - this is the correct flow direction. With the correct sequence, the lines connecting the blocks to each other do not show the direction. In other cases, the direction of the lines is indicated by arrows.

A correct algorithm scheme should not have more than one exit from processing blocks and less than two exits from blocks responsible for logical operations and condition checking.

How to build an algorithm correctly?

The structure of the algorithm, as mentioned above, must be built according to GOST, otherwise it will not be understandable and accessible to others.

The general recording methodology includes the following items:

The name by which it will be clear what problem can be solved using this scheme.

Each algorithm must have a clearly marked start and end.

Algorithmsall data, both input and output, must be clearly and clearly described.

computation of algorithms
computation of algorithms

When compiling an algorithm, one should note the actions that will allow performing the actions necessary for solving the problem on the selected data. Approximate view of the algorithm:

  • Chema name.
  • Data.
  • Start.
  • Teams.
  • End.

Proper construction of the circuit will greatly facilitate the calculation of algorithms.

Geometric shapes responsible for different actions in the algorithm

Horizontal oval - beginning and end (end sign).

Horizontal rectangle - calculation or other actions (process sign).

Horizontal parallelogram - input or output (data sign).

Horizontal rhombus - condition check (decision sign).

Elongated horizontal hexagon - modification (sign of preparation).

Algorithm models are shown below.

Formula-verbal version of the algorithm construction.

Formula-verbal algorithms are written in an arbitrary form, in the professional language of the area to which the task belongs. Description of actions in this way is carried out using words and formulas.

concept of algorithm types of algorithms
concept of algorithm types of algorithms

The concept of an algorithm in computer science

In the computer field, everything is based on algorithms. Without clear instructions entered in the form of a special code, no technique will work orprogram. At computer science lessons, students are trying to give the basic concepts of algorithms, teach them how to use them and create them on their own.

Creating and using algorithms in computer science is a more creative process than, for example, following instructions for solving a problem in mathematics.

There is also a special program "Algorithm" that helps people who are ignorant in the field of programming to create their own programs. Such a resource can become an indispensable assistant for those who are taking their first steps in computer science and want to create their own games or any other programs.

On the other hand, any program is an algorithm. But if the algorithm carries only the actions that need to be performed by inserting its data, then the program already carries the finished data. Another difference is that the program can be patented and private property, but the algorithm is not. An algorithm is a broader concept than a program.

Conclusion

In this article, we analyzed the concept of an algorithm and its types, learned how to write graphic schemes correctly.

Recommended: