Lably
Skip to content

Space complexity

Computer memory needed by an algorithm

  • 2 min read
  • 4 chapters

Related on Lably

Through Algorithm, Data structure and Big O notation

Similar to time complexity, space complexity is often expressed asymptotically in big O notation, such as O(n), O(nlog⁡n), O(nα), O(2n), etc., where n is a characteristic of the input influencing space complexity.

Space complexity classes

Analogously to time complexity classes DTIME(f(n)) and NTIME(f(n)), the complexity classes DSPACE(f(n)) and NSPACE(f(n)) are the sets of languages that are decidable by deterministic (respectively, non-deterministic) Turing machines that use O(f(n)) space. The complexity classes PSPACE and NPSPACE allow f to be any polynomial, analogously to P and NP. That is, PSPACE=⋃c∈Z+DSPACE(nc) and NPSPACE=⋃c∈Z+NSPACE(nc)

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Theoretical computer science