9.1. Concept of algorithm

Lecture



Algorithm is a strictly defined and understandable order for the contractor to perform a sequence of actions aimed at solving the problem.

The term "algorithm" comes from the Latin form of the name of the Central Asian mathematician Al-Khorezmi - Algorithmi. The algorithm is one of the basic concepts of computer science and mathematics.

The executor of the algorithm is some abstract or real (technical, biological or biotechnical) system, which is able to perform the actions prescribed by the algorithm.

To characterize the performer use several concepts:

• Wednesday;

• command system;

• elementary actions;

• failures.

The environment (or setting) is the performer’s “habitat”.

Any of the performers can execute commands only from some strictly defined list, which is a system of commands of the performer. For each command, the conditions of applicability are specified (in what states of the environment the command can be executed) and the results of the command execution are given.

After calling a command, the performer performs the corresponding elementary action.

A performer’s refusal may occur if the command is called when the environment is unacceptable for it. Most often, the performer does not know anything about the purpose of the algorithm. He performs all the actions proposed to him, without asking questions "why" and "why."

In computer science, the universal performer of algorithms is a computer.

The main properties of the algorithms include:

1) clarity for the performer - the performer of the algorithm must know how to carry it out;

2) discreteness (discontinuity, separation) - the algorithm should represent the process of solving the problem as the sequential execution of simple (or previously defined) steps (steps);

3) certainty - each rule of the algorithm must be clear, unambiguous and not leave room for arbitrariness. This property ensures the execution of the algorithm mechanically, without requiring any additional instructions or information about the problem being solved;

4) effectiveness (or finiteness) - the algorithm should lead to the solution of the problem in a finite number of steps;

5) mass character - an algorithm for solving a problem is performed in a general form, that is, it can be used for a certain class of problems that differ only in the input data. In this case, the source data can be selected from a specific area, which is called the scope of the algorithm.

In practice, the following forms of algorithm representation are most common:

• verbal - written in natural language;

• graphic - using images from graphic symbols;

• pseudo-codes - semi-formalized descriptions of algorithms in a certain conditional algorithmic language, which include both elements of a programming language and phrases of a natural language, generally accepted mathematical notation, etc .;

• software - texts in programming languages.

The verbal method of recording algorithms is a description of the successive stages of data processing. The algorithm can be set in any natural language. For example, the algorithm for finding the greatest common divisor of two natural numbers can be represented as the following sequence of actions:

1) the task of two numbers;

2) if the numbers are equal, then the choice of any of them as an answer and stop, otherwise - the continuation of the algorithm;

3) the definition of the larger of the numbers;

4) replacing the larger of the numbers with the difference of the larger and smaller of the numbers;

5) repeat the algorithm from step 2.

The above algorithm is used for any natural numbers and should lead to the solution of the problem.

The verbal method is not widespread, as it has some drawbacks:

• these descriptions are not strictly formalizable;

• differ in verbosity of records;

• allow for the ambiguity of interpretation of individual prescriptions.

The graphical way of presenting algorithms is more compact and visual than the verbal one. With this type of presentation, the algorithm is depicted as a sequence of interconnected functional blocks, each of which corresponds to the execution of a certain number of actions.

For graphic representation, the algorithm uses an image as a sequence of interconnected functional blocks, each of which corresponds to the execution of one or several actions. This graphical representation is called an algorithm diagram, or a flowchart.

In the flowchart, each of the types of actions (input of initial data, calculation of the values ​​of expressions, verification of conditions, control of repetition of actions, completion of processing, etc.) corresponds to a geometric figure represented as a block symbol. Block symbols are connected by transition lines, which determine the order of actions.

Pseudocode is a notation and rules system that is intended for uniform writing of algorithms. It occupies an intermediate place between natural and formal languages. On the one hand, the pseudocode is similar to the usual


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Informatics

Terms: Informatics