Question: What is an Algorithm ?


An Algorithm is a systematic step-by-step process which leads to a conclusion.

Here is an example:
To find the highest common factor of 24 and 60. First express each as a product of prime numbers 24 = 2 x 2 x 2 x 3 and 60 = 2 x 2 x 3 x 5. Next pick out the prime factors common to both. Then multiply these common prime factors together. 2 x 2 x 3 = 12.

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.

An informal definition could be an algorithm is a computer program that calculates something. For some people, a program is only an algorithm if it stops eventually. For others, a program is only an algorithm if it stops before a given number of calculation steps.

A prototypical example of an algorithm is Euclid's algorithm to determine the maximum common divisor of two integers greater than one: subtract the smallest number from the biggest one, repeat until you get a zero or a one. This procedure is known to stop always, and the number of subtractions needed is always smaller than the biggest of the two numbers.