Space complexity
Builds on Turing machineNondeterministic Turing machineMultitape Turing machineFormal languageBig O notation
Definition
Let be a finite alphabet. Consider a multitape Turing machine with a read-only input tape and one or more read-write work tapes. Suppose that is deterministic and halts on every input. Let be an input. The space used by on is the number of distinct work-tape cells that the heads of visit while runs on . The space complexity of is the function with For a nondeterministic Turing machine that halts on every branch, the maximum is also taken over all computation branches. For a function , is the set of languages decided by some deterministic machine with , in big O notation. The class is defined in the same way with nondeterministic machines.
Remarks
Example: the language lies in . A machine first checks that no comes before a , then counts the s and the s in two binary counters and compares them. Each counter holds a number at most , so it needs at most cells.
Non-example: a machine that runs forever on some input has no space complexity in this sense, because the definition asks that halts on every input.
The input tape is not counted. This makes sublinear bounds such as meaningful. For bounds , counting the input as well changes nothing up to a constant factor.
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
- no evidence level
- Big O notation concept
- Formal language concept
- Multitape Turing machine concept
- Nondeterministic Turing machine concept
- Turing machine concept
- Space complexity definition
Further reading
About this page
| Tag | 8P8SY5HEGX |
|---|---|
| URI | m2://8P8SY5HEGX |
| Kind | definition |
| Writing | W0 stub |
| MSC | 68Q15, 68Q04 |
| Defines | Space complexity |
| Uses | Turing machine, Nondeterministic Turing machine, Multitape Turing machine, Formal language, Big O notation |
| Changed | 3 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.