Definition:
Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output.
Characteristics of an Algorithm
- Input: An Algorithm can have 0 or more well defined inputs.
- Output: An algorithm should have 1 or more well-defined outputs and should match the desired output.
- Definiteness / Unambiguous: Algorithm should be clear and unambiguous. Each of its steps (or phases), and their inputs/outputs should be clear and must lead to only one meaning.
- Effectiveness / Feasible: Should be feasible with the available resources.
- Finiteness: Algorithms must terminate after a finite number of steps.
- Independent: An algorithm should have step-by-step directions, which should be independent of any programming code.
There are no special syntax for writing Algorithms –
- The most ideal way is writing in plain English so that even a lay man can understand and follow the flow of execution logic.
- Programmers often use a pseudo C or Basic style to write down the steps, but one must always free it from complicated syntaxes that language offers.