What is algorithm?
Algorithm is a sequence of steps used for computation to transform the input into the output. It is a tool used to solve specific computational problems. A step by step process which takes some input process the input to produce some output.
Example:
To sort a sequence of numbers into non-decreasing order an algorithm can be designed. This problem is known as sorting problem. This problem is defined as-
INPUT: A sequence of n numbers (a1, a2, ..., an).
OUTPUT: A permutation of the input sequence such that a1'<a2'<...<an'.
How to know which algorithm is best for given application?
When looking for best algorithm for given application the factors to see are-
- Number of items to be sorted
- Extent to which items are already sorted.
- Possible restrictions on item values.
- Architecture of computer.
- Kind of storage to be used.
Impressive!
ReplyDelete