What is space complexity?

Updated May 17, 2026

Short answer

Space complexity measures memory usage relative to input size.

Deep explanation

It includes auxiliary space used by algorithms. Efficient space usage improves scalability and reduces system load.

Real-world example

Streaming data instead of loading full datasets into memory.

Common mistakes

  • Ignoring memory overhead of recursive calls.

Follow-up questions

  • What is auxiliary space?
  • How does recursion affect space?

More Optimisation interview questions

View all →