Lecture
An algorithm of any complexity can be represented by a combination of three basic structures:
The main types of algorithms:
Linear algorithms in which all actions are performed one after another, regardless of the source data and the results of intermediate calculations. A typical form for a linear algorithm is the sequential execution of commands.
A branching is an algorithm in which, depending on the source data and the results of intermediate calculations, a choice is made on one of the possible options. Variants (directions of calculations), which can be used to implement the computational process, are called branches . The choice of branch depends on the results of checking some condition. If the condition is satisfied, then one branch is selected, if not, then the other branch. At the end of the branch there should be a special pointer showing the last action. You can, for example, use the words "End of branching."
Cyclic is an algorithm in which the result is obtained by repeatedly performing the same operations.
A cycle is a repetitive part of a computational process. There are always four actions in a loop:
The method of organizing the cycle depends on the condition of the problem. Sometimes the number of repetitions of the cycle is indicated. These are the so-called counter cycles (or arithmetic algorithms) .
The main difference is that in the second case, the cycle is executed at least once, and in the first case, it may turn out that the cycle is not executed at all.
Symbol name | Designation and Filling Example | Explanation |
Process | Computational action or sequence of actions | |
Decision | Condition check | |
Modification | Cycle start | |
Predefined process | Calculation by subroutine, standard subroutine | |
Output-input | Output-input in general | |
Start stop | The beginning, the end of the algorithm, the input-output in the subroutine | |
Document | Printing results |
Comments
To leave a comment
Informatics
Terms: Informatics