The first step in the program development is to devise and describe a precise plan of what you want the computer to do. This plan, expressed as a sequence of operations, is called an algorithm. An algorithm is just an outline or idea behind a program. something resembling C or Pascal, but with some statements in English rather than within the programming language. It is expected that one could translate each pseudocode statement to a small number of lines of actual code, easily and mechanically.
Definition
An algorithm is a finite set of steps defining the solution of a particular problem. An
algorithm is expressed in pseudocode - something resembling C language or Pascal,
but with some statements in English rather than within the programming language.
Developing an efficient algorithm requires lot of practice and skill. It must be noted
that an efficient algorithm is one which is capable of giving the solution to the
problem by using minimum resources of the system such as memory and processor’s
time. Algorithm is a language independent, well structured and detailed. It will enable
the programmer to translate into a computer program using any high-level language.
Features of Algorithm:
Criteria to be followed by an Algorithm
The following is the criteria to be followed by an algorithm:
Example: Let us try to develop an algorithm to compute and display the sum of two numbers
Top Down Design
Once we have defined the problem and have an idea of how to solve it, we can then use the powerful techniques for designing algorithms. Most of the problems are complex or large problems and to solve them we have to focus on to comprehend at one time, a very limited span of logic or instructions. A technique for algorithm design that tries to accommodate this human limitation is known as top-down design or stepwise refinement.
Top down design provides the way of handling the logical complexity and detail encountered in computer algorithm. It allows building solutions to problems in step by step. In this way, specific and complex details of the implementation are encountered only at the stage when sufficient groundwork on the overall structure and relationships among the various parts of the problem.
Before the top down design can be applied to any problem, we must at least have the outlines of a solution. Sometimes this might demand a lengthy and creative investigation into the problem while at another time the problem description may in itself provide the necessary starting point for the top-down design.
Top-down design suggests taking the general statements about the solution one at a
time, and then breaking them down into a more precise subtask / sub-problem. These
sub-problems should more accurately describe how the final goal can be reached. The
process of repeatedly breaking a task down into a subtask and then each subtask into
smaller subtasks must continue until the sub-problem can be implemented as the
program statement. With each spitting, it is essential to define how sub-problems
interact with each other. In this way, the overall structure of the solution to the
problem can be maintained. Preservation of the overall structure is important for
making the algorithm comprehensible and also for making it possible to prove the
correctness of the solution.