Glossary termConcept

Algorithm

Finite sequence of well-defined steps for solving a problem or performing a computation, such as sorting a list or finding a route.

An algorithm is a precise, step-by-step procedure for solving a class of problems. Given an input, it carries out a finite sequence of unambiguous instructions and produces an output. A recipe is an informal analogy; a more exact example is binary search, which finds a name in a sorted list by repeatedly checking the middle entry and discarding the half that cannot contain it. Algorithms are independent of any particular programming language: the same procedure can be written in many languages, carried out by hand or built directly into hardware.

The word derives from the name of the ninth-century Persian scholar Muhammad ibn Musa al-Khwarizmi, whose works, translated into Latin, spread Hindu-Arabic numerals and systematic calculation methods in Europe. Much older procedures exist, such as Euclid's method for finding the greatest common divisor of two numbers. Ada Lovelace published what is often considered the first algorithm intended for a machine in 1843. In the 1930s, Alonzo Church and Alan Turing gave the notion of effective computation a formal definition, and Donald Knuth later characterized algorithms by finiteness, definiteness, input, output and effectiveness.

Algorithms are judged by correctness and by efficiency, usually expressed in Big O notation, which describes how running time or memory grows with the size of the input. The choice of algorithm often matters more than raw hardware speed: sorting a million items with a method whose cost grows quadratically can take vastly longer than with merge sort. In everyday speech the word has broadened to mean the automated systems that rank social media feeds, set prices or screen job applicants, raising questions about transparency and algorithmic bias that reach well beyond computer science.

Key points

  • An algorithm must finish after a finite number of steps, and each step must be precisely defined.
  • The term derives from the name of the ninth-century scholar Muhammad ibn Musa al-Khwarizmi.
  • Efficiency is usually analyzed with Big O notation, comparing how cost grows as inputs get larger.
  • In public debate the word often refers to automated decision systems, raising concerns about transparency and bias.

Related entries

Glossary term

Data Structure

Programming

Way of organizing and storing data in a computer so that it can be accessed and modified efficiently, such as an array, list, tree or hash table.

Glossary term

Big O Notation

Programming

Mathematical notation describing how an algorithm's running time or memory use grows as its input size grows, ignoring constant factors.

Glossary term

Recursion

Programming

Technique in which a function solves a problem by calling itself on smaller instances of the same problem until it reaches a simple base case.

Glossary term

Algorithmic technique that solves complex problems by breaking them into overlapping subproblems and storing each result so it is computed only once.

Person

Donald Knuth

Programming

American computer scientist who wrote "The Art of Computer Programming", created the TeX typesetting system and shaped the analysis of algorithms.

Person

Alan Turing

AIProgramming

English mathematician who formalized computation with the Turing machine, broke wartime codes and asked whether machines can think.

Person

Ada Lovelace

Programming

English mathematician whose notes on Charles Babbage's Analytical Engine included what is often called the first published computer program.

Glossary term

Algorithmic Bias

AIIdeas and Culture

Systematic errors in automated systems that produce unfair outcomes, such as favoring or disadvantaging people based on race, gender or other traits.

Featured in guides

Referenced by

Other entries that discuss or point to Algorithm.