Algorithm
An algorithm is
a sequence of unambiguous instructions for solving a problem for obtaining a
required output for legitimate input in
a finite amount of time.
Features of an algorithm
Every Algorithm must satisfy the following:
1. Input-Zero
or more quantities are externally supplied.
2. Output-At
least one quantity is produced.
3. Definiteness-Each
instruction is clear and well defined.
4. Finiteness-The
algorithm terminates after a finite number of steps.
5. Correctness-Every
step of the algorithm must generate a correct output.
Advantages
- It is not dependent on any programming language, so it is easy to understand for anyone.
- It is a stepwise representation of a solution to a given problem.
- An algorithm uses a definite procedure.
- It is time consuming
- Big task are difficult to put in algorithm.
Notation of an algorithm
Methods of Specifying an Algorithm
There
are two operations for specifying an algorithm,
i. Using natural language
ii. Using Pseudo code
Using natural language
Using a natural language make
a brief and clear description of algorithms is difficult.
Using pseudocode
A pseudocode is a mixture of
a natural language and programming language.
- A pseudo code is more accurate than a natural language
- And the usage yields more succinct algorithm description.
In earlier days flow charts
were used for specifying an algorithm.Flowchart is a method of expressing an
algorithm graphically.Flowchart
is very complex for larger problem.
***********
No comments:
Post a Comment