# 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:

- Count of adjacent Vowel Consonant Pairs
- Sorting Algorithms Visualization : Bubble Sort
- Complexity Analysis of Binary Search
- Algorithms Sample Questions | Set 3 | Time Order Analysis
- Find the original coordinates whose Manhattan distances are given
- Algorithms Sample Questions | Recurrences | Set 2
- Find the largest interval that contains exactly one of the given N integers.
- Find number of magical pairs of string of length L
- Microsoft Interview experience for full time position of software engineer at Microsoft Ireland Research
- Maximum length of subarray such that sum of the subarray is even
- Longest substring of only 4's from the first N characters of the infinite string
- Find a Symmetric matrix of order N that contain integers from 0 to N-1 and main diagonal should contain only 0's
- Generate original array from difference between every two consecutive elements
- Find smallest number K such that K % p = 0 and q % K = 0
- Sort the numbers according to their sum of digits