How to solve problems with an algorithm

How to solve problems with an algorithm

The algorithm represents failure the sequence of precisely certain operations describing a necessary operations procedure for the solution of an objective. Any task can be solved by means of an algorithm. Before drawing up the instruction variables taking into account a statement of the problem are entered into an algorithm. The simplest types of an algorithm: linear, cyclic and algorithms with branching. Each of them, by final number of operations, carries out transition from introduction data to required result in a task.

Instruction

1. Attentively get acquainted with a condition of an initial task. Think over its decision: whether there is a recurrence in a task. Perhaps, operations which performance is caused by satisfaction of different conditions are set. Write out all known data and required sizes.

2. Any algorithm demands the formalized record. If you need to make the flowchart of an algorithm, use special elements for designation of each operation of the created instruction. As a rule, it is the blocks from rectangular and rhombic figures connected in the general tree.

3. Make the general algorithm of the solution of a task. On the first step enter the variables designating the known data and resulting values into an algorithm. Appropriate to variables the values, known from a statement of the problem.

4. Detail an algorithm. In detail paint a statement of the problem. Each step of the instruction has to be written down on a separate line. If necessary set cycles or branchings of an algorithm.

5. You make all actions in steps of the instruction with the set variables. If it is necessary to enter auxiliary variables, include them in addition at the very beginning of an algorithm.

6. Often from the meaning of an initial task in the course of the decision conditions at which satisfaction over data one action is carried out, and without satisfaction – another follow. In this case it is about an algorithm branching. Issue it two branches of a tree instruction.

7. If at an algorithm branching after passing of a condition one of branches needs to be returned back on an algorithm body, then the cyclic algorithm is formed. Accurately track that the cycle in the instruction was not infinite and had final number of iterations.

8. Any sequence of the performed operations has to result in the end result set in a statement of the problem. After obtaining required size, finish a body of an algorithm and write down the received answer.

Author: «MirrorInfo» Dream Team


Print