Algorithms in programming – basic knowledge.

Living each day puts us on the road to solve a variety of tasks, not just mathematics one. We provide the specific sequence of actions leading to a satisfactory result. If these steps are presented in the form of an ordered number of steps leading to a clear solution, we get the algorithm.

The algorithm is a set of tasks that lead to particular solution.

Constructing an algorithm is based on a flow. At the beginning we need to present the problem that we have to solve. Then, determine the type of input data (numbers, characters), and how to present the output data (as a result of the algorithm). The most important issue is the choice of method for performing the task. Methods may be a few, so we have to select the most optimal, eg in terms of execution speed. Analyzed task must be written using the method selected, and then checked the correctness of the solution and tested by entering different inputs.

**The algorithm must meet certain conditions:**

– Discretion – the algorithm should consist of basic, clearly defined steps, more complex elements to be presented in a separate algorithm;

– Universality – the solution algorithm should include a set of problems, not just one special case;

– Uniqueness – construction algorithm must clearly specify which of its basic elements are to be performed;

– Efficiency – the algorithm’s result should close in a finite number of specific steps, in the absence of a solution or when the solution is not get at a certain time, the algorithm must have specified conditions for termination or interruption its task.