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

- Partition the digits of an integer such that it satisfies a given condition
- C program for Time Complexity plot of Bubble, Insertion and Selection Sort using Gnuplot
- Program to print double headed arrow pattern
- Area of the circle that has a square and a circle inscribed in it
- Check if all the elements can be made of same parity by inverting adjacent elements
- Queries On Array with disappearing and reappearing elements
- Number of pairs in an array having sum equal to product
- Minimize the sum of digits of A and B such that A + B = N
- Multiplication on Array : Range update query in O(1)
- Optimal Strategy for a Game | Special Gold Coin
- Find the coordinates of a triangle whose Area = (S / 2)
- Rearrange array elements such that Bitwise AND of first N - 1 elements is equal to last element
- Maximum prime moves to convert X to Y
- Sum of Digits of the Good Strings
- Count non-adjacent subsets from numbers arranged in Circular fashion