# 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 integers that divide all the elements of the given array
- Maximum String Partition
- Length of longest subarray in which elements greater than K are more than elements not greater than K
- Minimum Possible sum of digits in a positive multiple of N
- Difference between Posteriori and Priori analysis
- How to learn Pattern printing easily?
- Find the smallest positive number missing from an unsorted array | Set 3
- Sum of all second largest divisors after splitting a number into one or more parts
- Count pairs of strings that satisfy the given conditions
- Minimum deletions required such that any number X will occur exactly X times
- Minimum deletions required to make GCD of the array equal to 1
- Find maximum value of the last element after reducing the array with given operations
- Find Nth smallest number that is divisible by 100 exactly K times
- Concatenate strings in any order to get Maximum Number of "AB"
- Minimum operations to make sum of neighbouring elements <= X