In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing. It is formally a type of effective method in which a list of well-defined instructions for completing a task will, when given an initial state, proceed through a well-defined series of successive states, eventually terminating in an end-state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as probabilistic algorithms, incorporate randomness.
A step-by-step method of solving a problem or making decisions, as in making a diagnosis.
An established mechanical procedure for solving certain mathematical problems.
Properties of the algorithm
- Finiteness. An algorithm must always terminate after a finite number of steps.
- Definiteness. Each step of an algorithm must be precisely defined; the actions to be carried out must be rigorously and unambiguously specified for each case.
- Input. An algorithm has zero or more inputs, i.e, quantities which are given to it initially before the algorithm begins.
- Output. An algorithm has one or more outputs i.e, quantities which have a specified relation to the inputs.
- Effectiveness. An algorithm is also generally expected to be effective. This means that all of the operations to be performed in the algorithm must be sufficiently basic that they can in principle be done exactly and in a finite length of time.
Complexity of Algorithm:
It is very convenient to classify algorithms based on the relative amount of time or relative amount of space they require and specify the growth of time /space requirements as a function of the input size. Thus, we have the notions of:
1. Time Complexity: Running time of the program as a function of the size of input
2. Space Complexity: Amount of computer memory required during the program execution, as a function of the input size.