Procedure that produces the answer to a question or the solution to a problem in a finite number of steps.
An algorithm that produces a yes or no answer is called a decision procedure; one that leads to a solution is a computation procedure. A mathematical formula and the instructions in a computer program are examples of algorithms. Euclid 's Elements (с 300 BC) contained an algorithm for finding the greatest common divisor of two integers. Manipulation of lists (searching for, inserting, and removing items) can be done efficiently by using algorithms.