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

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: **DSA Self Paced**. Become industry ready at a student-friendly price.

## Recommended Posts:

- Check if a large number is divisible by a number which is a power of 2
- Find Nth number in a sequence which is not a multiple of a given number
- Check if given permutation of 1 to N can be counted in clockwise or anticlockwise direction
- Largest number M less than N such that XOR of M and N is even
- Maximize profit in buying and selling stocks with Rest condition
- Count of paths in given Binary Tree with odd bitwise AND for Q queries
- Proof that Clique Decision problem is NP-Complete | Set 2
- Count of subarrays of size K having at least one pair with absolute difference divisible by K-1
- Maximum sum of even indexed elements obtained by right shift on an even sized subarray
- Sorting algorithm visualization : Insertion Sort
- Proof that Independent Set in Graph theory is NP Complete
- Complexity analysis of various operations of Binary Min Heap
- Frequency of maximum occurring subsequence in given string
- Largest substring where all characters appear at least K times | Set 2
- Number of cycles formed by joining vertices of n sided polygon at the center