LearnViz CompSci
Home / Learn / Theory & Discrete Math / Space Complexity Classes

Advanced Topic 41 of 51 Theory & Discrete Math

Space Complexity Classes

PSPACE, L and related memory-bounded classes.

How it works

Space complexity classes measure memory instead of time. L is solvable in logarithmic extra space, NL by nondeterministic logarithmic space, PSPACE in polynomial space and EXPSPACE in exponential space. Savitch's theorem shows that nondeterministic space s can be simulated in deterministic space s squared, so PSPACE equals NPSPACE, and the Immerman-Szelepcsenyi theorem shows NL equals co-NL. Known inclusions are L within NL within P within NP within PSPACE.

Where it is used

Graph reachability is NL-complete, and games and planning problems, such as generalized chess and quantified Boolean formulas, are PSPACE-complete. Streaming algorithms are constrained by small space.

Common pitfall

Space can be reused whereas time cannot, so space classes are relatively powerful. Confusing the input size with working memory, which is the extra space not counting the read-only input, is a common mistake. Do not assume low time implies low space. Recursion consumes stack space that must be counted. Learn canonical complete problems for each class.

Where it fits in the course

Space Complexity Classes is topic 41 of 51 in Theory & Discrete Math, rated Advanced. It follows SAT Problem. The next topic is Randomized Complexity.

Practice and explore

How to study this topic

  1. Read the explanation above and restate the definition in your own words.
  2. Open the interactive lesson and answer its mini quiz.
  3. Read the common pitfall, then write a short example that avoids it.
  4. Check your understanding in the Theory & Discrete Math quiz, and revisit the topic if you miss a question.

Frequently asked questions

What is Space Complexity Classes?
PSPACE, L and related memory-bounded classes. It belongs to Theory & Discrete Math and is an advanced-level topic.
Where do people use Space Complexity Classes?
Graph reachability is NL-complete, and games and planning problems, such as generalized chess and quantified Boolean formulas, are PSPACE-complete.
What is the most common mistake with Space Complexity Classes?
Space can be reused whereas time cannot, so space classes are relatively powerful.
What should I learn before this topic?
Start with SAT Problem, the topic just before it in Theory & Discrete Math.
How can I practice it?
Answer the mini quiz in the interactive lesson, then take the Theory & Discrete Math quiz. You can also explore Growth Rates (Big-O) in the Visual Lab.
Is Space Complexity Classes hard to learn?
It is an Advanced topic. Expect to read the explanation more than once and to connect it with earlier topics. Working through a small example by hand helps most.
How long does it take to learn Space Complexity Classes?
Most learners can read the explanation and finish the interactive lesson in under an hour. Fluency comes from applying the idea, so plan a few short practice sessions with the quiz.
Which topics are related to Space Complexity Classes?
SAT Problem, Randomized Complexity, P vs NP are closely connected. The full list is in the related topics section of this page.
What should I study after Space Complexity Classes?
Continue with Randomized Complexity, the next topic in Theory & Discrete Math.

Related topics