# What does ‘Space Complexity’ mean?

**Space Complexity:**

The term Space Complexity is misused for Auxiliary Space at many places. Following are the correct definitions of Auxiliary Space and Space Complexity.

*Auxiliary Space* is the extra space or temporary space used by an algorithm.

*Space Complexity *of an algorithm is total space taken by the algorithm with respect to the input size. Space complexity includes both Auxiliary space and space used by input.

For example, if we want to compare standard sorting algorithms on the basis of space, then Auxiliary Space would be a better criteria than Space Complexity. Merge Sort uses O(n) auxiliary space, Insertion sort and Heap Sort use O(1) auxiliary space. Space complexity of all these sorting algorithms is O(n) though.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

## Recommended Posts:

- Sort the numbers according to their sum of digits
- Choose points from two ranges such that no point lies in both the ranges
- Count all Prime Length Palindromic Substrings
- Minimum operations of the given type required to make a complete graph
- Code Optimization Technique (logical AND and logical OR)
- Greatest divisor which divides all natural number in range [L, R]
- Find the repeating and the missing number using two equations
- Algorithms | Recurrences | Set 1
- Difference between Recursion and Iteration
- Largest perfect square number in an Array
- Maximum number of parallelograms that can be made using the given length of line segments
- Probability of getting two consecutive heads after choosing a random coin among two different types of coins
- Check whether bitwise OR of N numbers is Even or Odd
- Jump Pointer Algorithm
- Count pairs (i,j) such that (i+j) is divisible by A and B both