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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Examples of Big-O analysis
- The Slowest Sorting Algorithms
- Subset Sum is NP Complete
- Time-Space Trade-Off in Algorithms
- Optimized Longest Path is NP Complete
- Proof that 4 SAT is NP complete
- Proof that Collinearity Problem is NP Complete
- Subset Equality is NP Complete
- Proof that SAT is NP Complete
- Double SAT is NP Complete
- Hitting Set problem is NP Complete
- Set cover is NP Complete
- 3-coloring is NP Complete
- Set partition is NP complete