ALGORITHM
Definition:An algorithm is a finite set of instructions, which accomplishes a particular task. An algorithm is a finite step-by-step list of well-defined instructions for solving a particular problem.
ALGORITHM NOTATION
The algorithm is a base of not only effective data structure but it is also the base of good programming. Therefore, it is necessary' that each algorithm should be written clearly.
The algorithm is a base of not only effective data structure but it is also the base of good programming. Therefore, it is necessary' that each algorithm should be written clearly.
A complete algorithmic notation is given below.
1. Name of algorithm:
Every algorithm is given a-name, written in capital letters.
Introductory Comments.
The algorithm name is followed by a brief description of the tasks the algorithm
performs. This description gives the name and types of variables used in the
algorithm.
2.Steps:
The algorithm is made of a sequence of numbered steps. Each beginning with a
phrase enclosed in square brackets which gives an abbreviated, description of that
step. Following this phrase is an ordered sequence of statements which describe the
actions to be executed, or tasks to be performed.
3.Comments:
An algorithm step .may terminates with a comment enclosed in round parenthesis,
which is used to help the reader better understand that step. Comments specify no
action and arc enclosed only for clarity.
Example of algorithm:
Algorithm GRADES( M1,M2, M3.M4.Average) .
This algorithm reads tour marks denoted by Ml. M2, M3, M4 and compute the
average grade, Al! Variables‘ are assumed to be real.
AVERAGE
(1) [Input individual marks]
Read (MLM2.M3, M4)
(2) [Compute average grade]
Averages (M l-+'M2+M3+M4)/4
(3) [ Output Result ]
Write ("Final grade is" , average)
(4) (Finish]
Exit
Comments
Post a Comment