Solving the problems of programming. Cyclic Algorithm
The uniqueness of programming capabilities,which is provided by modern computer systems, consists in the simplicity and accessibility of the solution of a whole range of very different tasks. The most complex issues are solved quickly and do not require additional costs of both time and intellectual efforts of the programmer. But even cutting-edge utilities-assistants work with a creak without the user mastering the basics that are familiar to us from the high school informatics course.
Starting to implement any of his ideas incode, the programmer simply must implement a schematic description of the progress of the solution. For a long time already invented the rules and order of compiling algorithms. In the special literature, the algorithm is given the definition of an exact and understandable prescription to perform a strictly defined sequence of operations. As a result of their implementation, we achieve the goal or arrive at a solution to the task.
The term "algorithm" was given its name on behalf ofthe Uzbek thinker Al-Khwarizmi. His work "Arithmetic treatise" became the basis of the rules of arithmetic operations on numbers, and the rules themselves were called algorithms. With the addition, subtraction, division and multiplication, the world history of programming began.
In a diverse list of different ways to solveof the same type, a cyclic algorithm is distinguished. It is like walking in a circle until a certain goal is achieved. The programming of cyclic algorithms has one complexity, it consists in the fact that if they are incorrectly compiled or misprints, the computer can "hang" ie. go to do the same operations an infinite number of times.
According to modern interpretation, the cyclicAn algorithm is the order of certain actions that are repeated over changing initial data. By itself this order is realized without certain difficulties. A cyclic algorithm is a combination of the capabilities of a linear algorithm and an algorithm with branching.
Despite the simplicity of implementation and a certainuniformity of tasks, for a given type of algorithms is characterized by the presence of several of their types. A cyclic algorithm serves to implement in practice three types of different cycles. According to their names, one can judge about their characteristic features and the type of tasks to be solved.
A cycle with a precondition involves checking the conditionto execute the algorithm before the list of operations (compiled as a linear algorithm). A cycle with a postcondition differs from the previous one in that the condition is checked after the linear component is executed. A cycle with a parameter is characterized by the presence of a certain indicator, increasing or decreasing with the execution of the list of operations. A cyclic algorithm with a counter, so sometimes called this type of loop.
Despite the ease of implementation of this typealgorithm by two less complicated variants, each modern programming language has its own set of instructions for composing cycles. It is possible to create in the body of one program from one to several cycles, depending on the nature of the problem being solved.
The cyclic algorithms themselves have received enormousdistribution in the programming process. In addition to specific programs that perform certain tasks, there are empty cycles. Their task is to create pauses.
The cycle itself can be represented by two generally accepted phrases. For example, the following instruction is already a cyclic algorithm:
to rub a handkerchief;
- if the handkerchief is dirty, then go to the beginning of the cycle.
You can come up with a lot of similar examples. Much more diverse manifested themselves in the execution of graphic tasks, even the creation of a raster on the monitor screen is a merit of cyclic programs. Arrays, logical tasks, serious and entertaining programs can not do without using the merits of cyclic algorithms.