What is space complexity?

Space Complexity

Space complexity is an amount of memory used by the algorithm (including the input values of the algorithm), to execute it completely and produce the result.

We know that to execute an algorithm it must be loaded in the main memory.

The memory can be used in different forms:

  • Variables (This includes the constant values and temporary values)
  • Program Instruction
  • Execution


Sometime Auxiliary Space is confused with Space Complexity. But Auxiliary Space is the extra space or the temporary space used by the algorithm during it`s execution.

Space Complexity = Auxiliary Space + Input space

13-August 12:37 AM 317 Views

 Prev question

Next question