educative.io

Not understanding space complexity of Quick Sort

Hello!
You have the following space complexities for the algorithms:
Insertion Sort - O(n)
Merge Sort - O(n)

On these two, you justify that could be 1 if we don’t consider the size of the array, but in the end, you decide to put O(n) at the table

Then, for the quick sort
Quick Sort - O(log n) - understand that’s because of the number of the stack calls in the recursion. But, here, are you not considering the size of the array at all?

And then, in the
Selection Sort - O(1) - you seem to change the heuristics you’ve used on the first 2, on considering the size of the array.

Can you please clarify a bit?
Thanks!


Course: https://www.educative.io/courses/mastering-data-structures-and-sorting-algorithms-in-javascript
Lesson: Quicksort (Time Complexity) - Mastering Data Structures and Sorting Algorithms in JavaScript