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

GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details

## Recommended Posts:

- Minimum sprinklers required to water a rectangular park
- Find intersection of intervals given by two lists
- Queries to find frequencies of a string within specified substrings
- Count of subarrays of size K which is a permutation of numbers from 1 to K
- Create an array such that XOR of subarrays of length K is X
- XOR of elements in a given range with updates using Fenwick Tree
- Minimum valued node having maximum depth in an N-ary Tree
- Count of elements which are power of 2 in a given range subarray for Q queries
- Two player game in which a player can remove all occurrences of a number
- Maximize 3rd element sum in quadruplet sets formed from given Array
- Count of Double Prime numbers in a given range L to R
- Paranthesis Theorem
- Count of elements which form a loop in an Array according to given constraints
- Count of ungrouped characters after dividing a string into K groups of distinct characters
- Range Queries to count the number of even parity values with updates