Definition: An algorithm is a description of a procedure which terminates with a result. Simple algorithms can be implemented within a function for instance, the factorial of a number x is x multipled by x-1 multipled by x-2 and so on until it is multiplied by 1. The glossary entry for recursion has code that illustrates this example.
More complex algorithms might require several functions or even a class to implement them.
Glossary:
A B C D E F G H I J K L M N O P Q R S T U V W X Y ZExamples: The algorithm for determining if a number is prime or not is well known. It just takes a very long time to run for large numbers.

