An algorithm is a finite sequence of steps, if followed on a particular set of values, known as input, always produce a non-empty set of values, known as output.
A typical algorithm has the following criteria
Ø Input: A set of zero or non-zero elements supplied from outside
Ø Output: A set of non-zero element produced by the algorithm
Ø Un-ambiguity: Each steps of algorithm is clearly defined and unambiguous in nature.
Ø Finiteness: Each input should produce output after a sequence of finite no of steps.
If we remove the last criterion from the previous list, then the sequence of steps is known as 'Procedure'. An algorithm is also a procedure with guaranteed output. But, a procedure may or may not produce output on a specific input.
Other than representing an algorithm as a sequence of steps, we can also use the following tools to represent an algorithm.
Ø Flow chart, and
Ø Pseudo code
Flow chart: A flowchart is an pictorial representation an algorithm, workflow or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows. The basic building blocks of a typical flow chart is shown in the table.
Pseudo code: Pseudo code is an informal natural language like representation of an algorithm, but frequently uses the structural conventions of some popular programming languages.
An algorithm expressed in a pseudo code, is not an executable program. But it helps programmer to understand the steps of an algorithm as well as the implementation of the algorithm using a programming language.
No comments:
Post a Comment