Algorithms and algorithmic language
A fairly common way to submit algorithms is their record using algorithmic language, which in general is a system of notations and rules for the uniform and accurate recording of algorithms and their execution. Note that between the concepts "algorithmic language" and "programming languages" there is a difference; first of all, under the executor in the algorithmic language, not only a computer, but also a device for working "in an environment" can be implied. A program written in an algorithmic language is not necessarily intended for a computer. Practical implementation of algorithmic language is a separate issue in each specific case.
Like every language, the algorithmic language has its own vocabulary. The basis of this dictionary is the words used to write commands that are part of the commander's system of an algorithm. Such commands are called simple commands. In the algorithmic language, words are used, the meaning and method of using them is given once and for all. These words are called official. The use of auxiliary words makes the recording of algorithms more visual, and the form of representation of different algorithms is uniform.
Algorithms written in algorithmic language should have a name. The name should be chosen in such a way that it is clear that the solution of which problem describes the given algorithm. To distinguish the name of the algorithm before it, write the service word ALG (ALGoritm). Behind the name of the algorithm (usually from a new line) is written his commands. To indicate the beginning and the end of the algorithm, its commands are enclosed in a pair of service words INCH (START) and KON (KONETS). The commands are written sequentially.
When constructing new algorithms, algorithms compiled earlier can be used. Algorithms entirely used in the composition of other algorithms are called auxiliary algorithms. An auxiliary algorithm can be any of the previously compiled algorithms. It is also not excluded that an auxiliary in a certain situation may turn out to be an algorithm itself containing a reference to auxiliary algorithms.
Very often, when composing algorithms, it becomes necessary to use as an auxiliary one and the same algorithm, which can also be very complicated and cumbersome. It would be irrational, starting work, each time to re-compile and memorize such an algorithm for its subsequent use. Therefore, in practice, widely used, so-called, built-in (or standard) auxiliary algorithms, i.e. such algorithms that are constantly available to the executor. Appeal to such algorithms is carried out in the same way as to "ordinary" auxiliary algorithms.
The algorithm can contain a reference to itself as an auxiliary, and in this case it is called recursive. If the command of the algorithm's return to itself is in the algorithm itself, then such a recursion is called a straight line. There are cases when a recursive call of the given algorithm comes from an auxiliary algorithm to which there is an inversion in the given algorithm. This recursion is called indirect.
Algorithms, in the execution of which the order of commands is determined depending on the results of checking certain conditions, are called branching. For their description in algorithmic language use a special compound command - the branch command. It corresponds to the flowchart "alternative" and can also have a complete or abbreviated form.
Algorithms, in the performance of which individual commands or series of instructions are executed repeatedly, are called cyclic. For the organization of cyclic algorithms in an algorithmic language use a special compound command of the cycle.
