You can make quicksort O(n log n) with an optimal quickselect-based choice of pivot but the constant-factor cost is so high it becomes impractical.
Quicksort is O(n²) and O(log n) working space, O(n) working space if implemented naively.
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.