Hacker News new | ask | show | jobs
by gpderetta 19 days ago
quicksort worst case space bound is still O(logN) as you can tail call on the longest partition and need to maintain a stack only for the other one.
1 comments

Yes. That isn't textbook quicksort. Ie, the Hoare or Lomuto quicksorts recurse both sides. [1]

But it is a sensible improvement.

(EDIT: I typoed my original comment. It O(n^2) space; worst case is O(n) space and O(n^2) time for the vanilla alg.)

[1] https://en.wikipedia.org/wiki/Quicksort