
In recursive calls stack space also counts.Įach of these calls is added to call stack and takes up actual memory. If we create a two-dimensional array of size n*n, this will require O(n 2) space. If we need to create an array of size n, this will require O(n) space. Space complexity is a parallel concept to time complexity. The space complexity of all these sorting algorithms is O(n) though. Merge Sort uses O(n) auxiliary space, Insertion sort, and Heap Sort use O(1) auxiliary space. Space complexity includes both Auxiliary space and space used by input.įor example, if we want to compare standard sorting algorithms on the basis of space, then Auxiliary Space would be a better criterion than Space Complexity. Space Complexity of an algorithm is the total space taken by the algorithm with respect to the input size. Complexity of different operations in Binary tree, Binary Search Tree and AVL treeĪuxiliary Space is the extra space or temporary space used by an algorithm.Understanding Time Complexity with Simple Examples.Practice Questions on Time Complexity Analysis.Analysis of Algorithms | Set 1 (Asymptotic Analysis).Fibonacci Heap – Deletion, Extract min and Decrease key.Analysis of Algorithm | Set 5 (Amortized Analysis Introduction).Analysis of Algorithm | Set 4 (Solving Recurrences).Analysis of Algorithms | Set 4 (Analysis of Loops).Analysis of Algorithms | Set 3 (Asymptotic Notations).Analysis of Algorithms | Set 2 (Worst, Average and Best Cases).ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.
