Math 2.0

Computer science Definition

Algorithm

Builds on Turing machineModel of computation

Definition

Let II and OO be sets of finite objects, the inputs and the outputs, encoded as strings over a finite alphabet. An algorithm from II to OO is a finite description of a procedure with these properties:

  1. at each stage the procedure performs one elementary step, which is uniquely determined by the description and the current data;
  2. for each input x∈Ix \in I the procedure stops after finitely many steps;
  3. when it stops on input xx, it outputs an element f(x)∈Of(x) \in O.

The algorithm then computes the function f ⁣:I→Of \colon I \to O. In a fixed model of computation this is made exact: an algorithm is, for example, a Turing machine that halts on every input in II.

Remarks

The informal clauses and the formal model are linked by the Church–Turing thesis, which is a thesis and not a theorem. It says that every function computable by an informal algorithm is computable by a Turing machine. Many texts drop clause 2 and call a procedure that may run forever a partial algorithm or a semi-algorithm. Randomized and nondeterministic algorithms relax clause 1.

Example: the Euclidean algorithm is an algorithm from pairs of natural numbers to natural numbers. Each step replaces (a,b)(a, b) by (b,a mod b)(b, a \bmod b), the second entry strictly decreases while it is positive, so the procedure stops, and it outputs gcd⁡(a,b)\gcd(a, b).

Non-example: "search the natural numbers n=1,2,3,…n = 1, 2, 3, \dots for an odd perfect number and output the first one found" is a precise procedure. But nobody knows whether it stops, so it is not known to satisfy clause 2.

Reading path

To understand this page from the ground up, read these 3 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Model of computation concept
  2. Turing machine concept
  3. Algorithm definition

Where this leads

1 page builds on this one.

Further reading

  1. Web https://en.wikipedia.org/wiki/Algorithm
About this page
Tag5K1F0ZSN51
URIm2://5K1F0ZSN51
Kinddefinition
WritingW0 stub
MSC68W01, 68Q10
DefinesAlgorithm
UsesTuring machine, Model of computation
Changed3 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

Used by