Math 2.0

Computer science Definition

Time complexity

Builds on Turing machineMultitape Turing machineDecidable languageStringBig O notation

Definition

Let MM be a deterministic multitape Turing machine with input alphabet Σ\Sigma that halts on every input. The running time, or time complexity, of MM is the function tM ⁣:ℕ→ℕt_M \colon \N \to \N given by tM(n)=max⁡{number of steps of M on input w:w∈Σ∗, ∣w∣=n},t_M(n) = \max \set{\text{number of steps of } M \text{ on input } w : w \in \Sigma^*, \ \abs{w} = n}, where ∣w∣\abs{w} is the length of the string ww. For a function f ⁣:ℕ→ℕf \colon \N \to \N, DTIME(f(n))\mathrm{DTIME}(f(n)) is the class of languages decided by some such machine MM with tM(n)=O(f(n))t_M(n) = O(f(n)), in big O notation.

Remarks

Example: the language {0k1k:k≥0}\set{0^k 1^k : k \ge 0} is in DTIME(n)\mathrm{DTIME}(n). A two-tape machine checks that the input has the form 0∗1∗0^* 1^* and copies the 00s to its second tape. Then it crosses off one of them for each 11, so it uses O(n)O(n) steps. On a single-tape Turing machine this language can be decided in time O(nlog⁡n)O(n \log n) but not in time O(n)O(n). In fact every language decided by a single-tape machine in time o(nlog⁡n)o(n \log n) is regular. Non-example: a machine that does not halt on some input has no time complexity in this sense. The same definitions apply to other models, such as random-access machines, where each instruction counts as one step.

Reading path

To understand this page from the ground up, read these 6 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. Big O notation concept
  2. Decidable language concept
  3. Multitape Turing machine concept
  4. String concept
  5. Turing machine concept
  6. Time complexity definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Time_complexity
About this page
TagQ2CA3SSY4N
URIm2://Q2CA3SSY4N
Kinddefinition
WritingW0 stub
MSC68Q25, 68Q15, 68W40
DefinesTime complexity
UsesTuring machine, Multitape Turing machine, Decidable language, String, Big O notation
Changed3 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • 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

No page links to this page yet.