# DSPACE

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/DSPACE
> Markdown URL: https://mediated.wiki/source/DSPACE.md
> Source: https://en.wikipedia.org/wiki/DSPACE
> Source revision: 1350070294
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Memory space for a deterministic Turing machine

For digital repositories, see [DSpace](/source/DSpace).

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "DSPACE" – news · newspapers · books · scholar · JSTOR (October 2009) (Learn how and when to remove this message)

In [computational complexity theory](/source/Computational_complexity_theory), **DSPACE** or **SPACE** is the [computational resource](/source/Computational_resource) describing the resource of [memory space](/source/Memory_space_(computational_resource)) for a [deterministic Turing machine](/source/Deterministic_Turing_machine). It represents the total amount of memory space that a "normal" physical computer would need to solve a given [computational problem](/source/Computational_problem) with a given [algorithm](/source/Algorithm).

## Complexity classes

The measure **DSPACE** is used to define [complexity classes](/source/Complexity_class), sets of all of the [decision problems](/source/Decision_problem) that can be solved using a certain amount of memory space. For each function *f*(*n*), there is a [complexity class](/source/Complexity_class) SPACE(*f*(*n*)), the set of [decision problems](/source/Decision_problem) that can be solved by a [deterministic Turing machine](/source/Deterministic_Turing_machine) using space *O*(*f*(*n*)). There is no restriction on the amount of [computation time](/source/Computation_time) that can be used, though there may be restrictions on some other complexity measures (like [alternation](/source/Alternation_(complexity))).

Several important complexity classes are defined in terms of **DSPACE**. These include:

- [REG](/source/Regular_language) = DSPACE(*O*(1)), where **REG** is the class of [regular languages](/source/Regular_language). In fact, REG = DSPACE(*o*(log log *n*)) (that is, Ω(log log *n*) space is required to recognize any non-regular language).[1][2]

*Proof:* Suppose that there exists a non-regular language *L* ∈ DSPACE(*s*(*n*)), for *s*(*n*) = *o*(log log *n*). Let *M* be a [Turing machine](/source/Turing_machine) deciding *L* in space *s*(*n*). By our assumption *L* ∉ DSPACE(*O*(1)); thus, for any arbitrary k ∈ N {\displaystyle k\in \mathbb {N} } , there exists an input of *M* requiring more space than *k*.

Let *x* be an input of smallest size, denoted by n, that requires more space than *k*, and C {\displaystyle {\mathcal {C}}} be the set of all [configurations](/source/Turing_machine) of *M* on input *x*. Because *M* ∈ DSPACE(*s*(*n*)), then | C | ≤ 2 c ⋅ s ( n ) = o ( log ⁡ n ) {\displaystyle |{\mathcal {C}}|\leq 2^{c\cdot s(n)}=o(\log n)} , where *c* is a constant depending on *M*.

Let *S* denote the set of all possible [crossing sequences](/source/Crossing_sequence_(Turing_machines)) of *M* on *x*. Note that the length of a crossing sequence of *M* on *x* is at most | C | {\displaystyle |{\mathcal {C}}|} : if it is longer than that, then some configuration will repeat, and *M* will go into an infinite loop. There are also at most | C | {\displaystyle |{\mathcal {C}}|} possibilities for every element of a crossing sequence, so the number of different crossing sequences of *M* on *x* is

- | S | ≤ | C | | C | ≤ ( 2 c ⋅ s ( n ) ) 2 c ⋅ s ( n ) = 2 c ⋅ s ( n ) ⋅ 2 c ⋅ s ( n ) < 2 2 2 c ⋅ s ( n ) = 2 2 o ( log ⁡ log ⁡ n ) = o ( n ) {\displaystyle |S|\leq |{\mathcal {C}}|^{|{\mathcal {C}}|}\leq (2^{c\cdot s(n)})^{2^{c\cdot s(n)}}=2^{c\cdot s(n)\cdot 2^{c\cdot s(n)}}<2^{2^{2c\cdot s(n)}}=2^{2^{o(\log \log n)}}=o(n)}

According to [pigeonhole principle](/source/Pigeonhole_principle), there exist indexes *i* < *j* such that C i ( x ) = C j ( x ) {\displaystyle {\mathcal {C}}_{i}(x)={\mathcal {C}}_{j}(x)} , where C i ( x ) {\displaystyle {\mathcal {C}}_{i}(x)} and C j ( x ) {\displaystyle {\mathcal {C}}_{j}(x)} are the crossing sequences at boundary *i* and *j*, respectively.

Let x' be the string obtained from x by removing all cells from *i* + 1 to *j*. The machine M still behaves exactly the same way on input x' as on input x, so it needs the same space to compute x' as to compute x. However, |*x'*| < |*x*|, contradicting the definition of x. Hence, there does not exist such a language L as assumed. □

The above theorem implies the necessity of the [space-constructible function](/source/Space-constructible_function) assumption in the [space hierarchy theorem](/source/Space_hierarchy_theorem).

- [L](/source/L_(complexity)) = DSPACE(*O*(log *n*))

- [PSPACE](/source/PSPACE) = ⋃ k ∈ N D S P A C E ( n k ) {\displaystyle \bigcup _{k\in \mathbb {N} }{\mathsf {DSPACE}}(n^{k})}

- [EXPSPACE](/source/EXPSPACE) = ⋃ k ∈ N D S P A C E ( 2 n k ) {\displaystyle \bigcup _{k\in \mathbb {N} }{\mathsf {DSPACE}}(2^{n^{k}})}

## Machine models

**DSPACE** is traditionally measured on a [deterministic Turing machine](/source/Deterministic_Turing_machine). Several important space complexity classes are [sublinear](/source/Sublinear), that is, smaller than the size of the input. Thus, "charging" the algorithm for the size of the input, or for the size of the output, would not truly capture the memory space used. This is solved by defining the [multi-tape Turing machine with input and output](/source/Multi-tape_Turing_machine_with_input_and_output), which is a standard multi-tape Turing machine, except that the input tape may never be written-to, and the output tape may never be read from. This allows smaller space classes, such as [L](/source/L_(complexity)) (logarithmic space), to be defined in terms of the amount of space used by all of the work tapes (excluding the special input and output tapes).

Since many symbols might be packed into one by taking a suitable power of the alphabet, for all *c* ≥ 1 and *f* such that *f*(*n*) ≥ *1*, the class of languages recognizable in *cf*(*n*) space is the same as the class of languages recognizable in *f*(*n*) space. This justifies usage of [big O notation](/source/Big_O_notation) in the definition.

## Hierarchy theorem

The [space hierarchy theorem](/source/Space_hierarchy_theorem) shows that, for every [space-constructible function](/source/Space-constructible_function) f : N → N {\displaystyle f:\mathbb {N} \to \mathbb {N} } , there exists some language *L* that is decidable in space O ( f ( n ) ) {\displaystyle O(f(n))} but not in space o ( f ( n ) ) {\displaystyle o(f(n))} .

Further information: [space hierarchy theorem](/source/Space_hierarchy_theorem)

## Relation with other complexity classes

**DSPACE** is the deterministic counterpart of **[NSPACE](/source/NSPACE)**, the class of [memory space](/source/Memory_space_(computational_resource)) on a [non-deterministic Turing machine](/source/Non-deterministic_Turing_machine). By [Savitch's theorem](/source/Savitch's_theorem),[3] we have that

- D S P A C E ( s ( n ) ) ⊆ N S P A C E ( s ( n ) ) ⊆ D S P A C E ( ( s ( n ) ) 2 ) . {\displaystyle {\mathsf {DSPACE}}(s(n))\subseteq {\mathsf {NSPACE}}(s(n))\subseteq {\mathsf {DSPACE}}{\bigl (}(s(n))^{2}{\bigr )}.}

**[NTIME](/source/NTIME)** is related to DSPACE in the following way. For any [time constructible](/source/Time_constructible) function *t*(*n*), we have

- N T I M E ( t ( n ) ) ⊆ D S P A C E ( t ( n ) ) {\displaystyle {\mathsf {NTIME}}(t(n))\subseteq {\mathsf {DSPACE}}(t(n))} .

A much better simulation is known for [deterministic time](/source/DTIME): if t ( n ) ≥ n {\displaystyle t(n)\geq n} ,

- D T I M E ( t ( n ) ) ⊆ D S P A C E ( t ( n ) log ⁡ t ( n ) ) {\displaystyle {\mathsf {DTIME}}(t(n))\subseteq {\mathsf {DSPACE}}\left({\sqrt {t(n)\log t(n)}}\right)}

by a result of [Williams](/source/Ryan_Williams_(computer_scientist)),[4] improving an older bound of O ( t / log ⁡ t ) {\displaystyle O(t/\log t)} by [Hopcroft](/source/John_Hopcroft), Paul, and [Valiant](/source/Leslie_Valiant).[5]

On the other hand, for any function s ( n ) ≥ log ⁡ n {\displaystyle s(n)\geq \log n} ,

- D S P A C E ( s ( n ) ) ⊆ D T I M E ( 2 O ( s ( n ) ) ) {\displaystyle {\mathsf {DSPACE}}(s(n))\subseteq {\mathsf {DTIME}}{\bigl (}2^{O(s(n))}{\bigr )}} .

## References

1. **[^](#cite_ref-AS28_1-0)** Szepietowski (1994) p. 28

1. **[^](#cite_ref-2)** Alberts, Maris (1985), *Space complexity of alternating Turing machines*

1. **[^](#cite_ref-AB86_3-0)** Arora & Barak (2009) p. 86

1. **[^](#cite_ref-4)** Ryan Williams, R. (2025-06-15). ["Simulating Time with Square-Root Space"](https://doi.org/10.1145/3717823.3718225). *Proceedings of the 57th Annual [ACM Symposium on Theory of Computing](/source/ACM_Symposium_on_Theory_of_Computing)*. ACM. pp. 13–23. [doi](/source/Doi_(identifier)):[10.1145/3717823.3718225](https://doi.org/10.1145%2F3717823.3718225). [ISBN](/source/ISBN_(identifier)) [979-8-4007-1510-5](https://en.wikipedia.org/wiki/Special:BookSources/979-8-4007-1510-5).

1. **[^](#cite_ref-5)** Hopcroft, John; Paul, Wolfgang; Valiant, Leslie (April 1977). ["On Time Versus Space"](https://dl.acm.org/doi/10.1145/322003.322015). *[Journal of the ACM](/source/Journal_of_the_ACM)*. **24** (2): 332–337. [doi](/source/Doi_(identifier)):[10.1145/322003.322015](https://doi.org/10.1145%2F322003.322015). [hdl](/source/Hdl_(identifier)):[1813/6755](https://hdl.handle.net/1813%2F6755). [ISSN](/source/ISSN_(identifier)) [0004-5411](https://search.worldcat.org/issn/0004-5411).

- Szepietowski, Andrzej (1994). *Turing Machines with Sublogarithmic Space*. [Springer Science+Business Media](/source/Springer_Science%2BBusiness_Media). [ISBN](/source/ISBN_(identifier)) [978-3-540-58355-4](https://en.wikipedia.org/wiki/Special:BookSources/978-3-540-58355-4).

- [Arora, Sanjeev](/source/Sanjeev_Arora_(computer_scientist)); [Barak, Boaz](/source/Boaz_Barak) (2009). *Computational complexity. A modern approach*. [Cambridge University Press](/source/Cambridge_University_Press). [ISBN](/source/ISBN_(identifier)) [978-0-521-42426-4](https://en.wikipedia.org/wiki/Special:BookSources/978-0-521-42426-4). [Zbl](/source/Zbl_(identifier)) [1193.68112](https://zbmath.org/?format=complete&q=an:1193.68112).

## External links

- *[Complexity Zoo](/source/Complexity_Zoo)*: [DSPACE(*f*(*n*))](https://complexityzoo.net/Complexity_Zoo:D#dspace).

v t e Complexity classes Considered feasible DLOGTIME AC0 ACC0 REG TC TC0 L SL RL FL NL NL-complete NC SC CC P P-complete ZPP RP BPP BQP APX FP Suspected infeasible UP NP NP-complete NP-hard co-NP co-NP-complete TFNP FNP AM QMA PH ⊕P PP #P #P-complete IP PSPACE PSPACE-complete Considered infeasible EXPTIME NEXPTIME EXPSPACE 2-EXPTIME ELEMENTARY NONELEMENTARY PR R RE ALL Other complexity classes polyL QP Class hierarchies Polynomial hierarchy Exponential hierarchy Grzegorczyk hierarchy Arithmetical hierarchy Boolean hierarchy Families of classes DTIME NTIME DSPACE NSPACE Probabilistically checkable proof Interactive proof system List of complexity classes

---
Adapted from the Wikipedia article [DSPACE](https://en.wikipedia.org/wiki/DSPACE) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/DSPACE?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
