Skip to content

Algorithm

Prime #
11
Origin domain
Computer Science & Software Engineering
Also from
Mathematics
Related primes
Function (Mapping)

Core Idea

Step-by-step procedure for solving a problem.

How would you explain it like I'm…

Step-by-Step Recipe

When you make a peanut butter sandwich, you do the same steps in the same order every time: get bread, open jar, spread, close. If you follow the steps just right, you always end up with a sandwich. A recipe like that, written so anyone can follow it, is an algorithm.

Recipe of Exact Steps

An algorithm is a list of steps that takes some starting stuff and turns it into a result. The steps have to be clear enough that anyone — or even a machine — could follow them without guessing. There must be a finite number of steps, each step must be unambiguous, and the procedure has to stop. A recipe, the long-division method, and instructions for tying your shoes are all algorithms. The point isn't just what answer you want; it's the exact, repeatable way of getting there.

Step-by-Step Procedure

An algorithm is a finite, definite, effective procedure for transforming inputs into outputs by a prescribed sequence of steps. The essential commitment is to *procedure*: not just what the answer is (that's a function) but the ordered, mechanically executable way of producing it. Every algorithm specifies its admissible inputs, a finite sequence of unambiguous steps, a termination condition it is guaranteed (or expected) to reach, and the result it produces at termination. The classical constraints — finiteness (it ends), definiteness (each step is unambiguous), and effectiveness (each step can actually be carried out) — together ensure the procedure can be executed without needing intelligence or judgment to fill in gaps.

 

An algorithm is a finite, definite, effective procedure for transforming inputs into outputs by a sequence of prescribed steps. The essential commitment is to *procedure*: not merely what the output should be — that is a function, a mathematical mapping — but the ordered, mechanically executable way of producing it. Every algorithm specifies four ingredients: (1) its admissible inputs, the class of objects it operates on; (2) a finite sequence of unambiguous steps; (3) a termination condition that the procedure is guaranteed (or in randomized cases, expected) to reach; and (4) a result it produces at termination. The classical constraints, articulated in Knuth's standard treatment, are finiteness (the procedure halts in a finite number of steps), definiteness (each step is precisely specified, with no ambiguity), and effectiveness (each step is sufficiently basic that it can in principle be carried out exactly by a person with paper and pencil). Together these constraints ensure the procedure can be executed without appeal to intelligence or judgment. The distinction between algorithm and function is structural: many distinct algorithms can compute the same function (e.g., several sorting algorithms all sort), and one algorithm's complexity profile and resource requirements can differ sharply from another's even when their outputs agree.

Broad Use

Guides reasoning in structured problem-solving (e.g., recipes, workflows, or business processes).

Clarity

Breaks processes into repeatable, structured steps, like recipes or sorting algorithms.

Manages Complexity

Standardizes problem-solving into repeatable steps.

Abstract Reasoning

Encourages structured, sequential reasoning and process optimization.

Knowledge Transfer

Found in computer science, logistics, and medicine (diagnostic protocols).

Example

A navigation app uses Dijkstra's algorithm to find the shortest path between two locations.

Relationships to Other Primes

One-hop neighborhood: parents above, mutual partners to the right, children below.Algorithmcomposition: IterationIterationcomposition: Function (Mapping)Function(Mapping)

Parents (2) — more general patterns this builds on

  • Algorithm presupposes Function (Mapping) — An algorithm presupposes function because the procedure it specifies is precisely a mechanical way of realizing a deterministic input-to-output mapping.
  • Algorithm presupposes Iteration — An algorithm presupposes iteration because executing a finite sequence of prescribed steps that update state until termination is the iterative pattern.

Path to root: AlgorithmIteration

Not to Be Confused With

  • Algorithm is not Transformation because transformation is a general mapping rule from inputs to outputs; an algorithm is a sequence of deterministic steps that, when executed, performs a computation or transformation—transformation is the abstract mapping; algorithm is the executable procedure.
  • Algorithm is not Recursion because recursion is the self-referential pattern where a function calls itself with reduced problem size; an algorithm may use recursion as a technique but can also use iteration or other control structures—recursion is a specific control pattern; algorithm is the broader executable procedure.
  • Algorithm is not Heuristic because a heuristic is a practical rule or shortcut that produces good (but not guaranteed optimal) results efficiently; an algorithm is a step-by-step procedure that is deterministic and guaranteed to terminate with a specified output—heuristic sacrifices optimality for efficiency; algorithm guarantees correctness.
  • Algorithm is not Iteration because iteration is the repetition of a process; an algorithm may use iteration but also uses other control structures (conditionals, recursion)—iteration is a control technique; algorithm is the full executable procedure.
  • Algorithm is not Sequencing because sequencing is the ordering of actions in time; an algorithm specifies not just the sequence but the logical control flow, conditionals, and data transformations—sequencing is the ordering; algorithm is the complete procedure with logic and data structures.