Algorithm pseudo code and flow charts
Algorithm: before writing the program the programmer must understand the problem for which are program is to be written. Then algorithm can be written. An algorithm is the step wise program definition written in simple and precise language in which the large problems is broken into unbreakable steps. So that each step can be easily converted into programming statement. For writing the algorithm knowledge of computer language is not required . an algorithm has followings features.
a.Finiteness : must terminate after a fixed number of steps.
b.Definiteness - each step must be precisely defined.
c.Effectiveness - all operations used in algorithm should be the basic operations and can be converted into programming instructions directly.
For example if we want to write a program to add two numbers. The algorithm for it which is independent of any programming language may be written as follows:
Algorithm to add two numbers:
a.Read first number.
b.Read second number.
c.Add numbers and save the sum.
d.Display results .
Pseudo code : An algorithm may be written in simple language as initially we may not know which programming language will be used to implement the algorithm. Some times it may be difficult to convert an algorithm into the computer program. Hence an intermediate language, which is in between teh algorithm and actual programming language is used. This language is called pseudo code.
For example the algorithm written above to add two numbers may be converted to the pseudo code as follows if programming is to be done in assembly language of 8085 .
A-FIRST NO
B-SECOND NO
A-A+B
DISPLAY PORT - A (SUM)
Flow chart : flow chart is the graphical representation of the algorithm which shows the flow of program execution. It uses various symbols to represent different processors. The symbols which are used in the book are explained below.