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.
Got what you were looking for? Learn more and become self sufficient. Start learning Data Sructures & Algorithms with the help of the most trusted DSA Self Paced course, and that too at the most student-friendly price.
Recommended Posts:
- Proof that Hamiltonian Cycle is NP-Complete
- Count of pairs in a given range with sum of their product and sum equal to their concatenated number
- Last digit of a number raised to last digit of N factorial
- Check if all nodes of the Binary Tree can be represented as sum of two primes
- Proof that Dominant Set of a Graph is NP-Complete
- Minimum sprinklers required to water a rectangular park
- Proof that traveling salesman problem is NP Hard
- 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

