An algorithm is a method, or a set of step-by-step instructions for performing some task or calculation, especially for computer programs.

For example, suppose we want an algorithm to find the average of a list of numbers. We must add them up and then divide by n, where n is the count of how many numbers there are. The algorithm for this might look like:

start with a list of numbers (like 2, 5, 99, -4, 20)
set the total to zero
start at the top of the list
repeat the following until end of list
    get the next number from list
    add it to the running total
At the end of the list - the average is the total divided by the length of the list

When an algorithm is written out in this English-like way it is called 'pseudo-code'. It looks a little like computer code (programming), but is really meant to describe the algorithm to another person.

As a program

The algorithm is a step-by-step method for solving a problem. It can then be translated into a program that a computer could perform. So for example, the above algorithm might be put into a program form in the Javascript language as follows:
var list = [2, 5, 99, -4, 20];
var total = 0;
var average;

for(var i=0; i<list.length; i++);
  { total = total + list[i];
average = total/list.length;
So, as you can see, the algorithm is the method for getting the job done, which is then written in a computer language of your choice so it can performed by the computer.

Pages referring to 'algorithm'

A method of calculating the area of a polygon given the coordinates of each vertex.
An algorithm for drawing circles and ellipses using the parametric form of the equation of a circle.