Merge sort

medium

Nothing happens on the way down - all the work is in the merges on the way up. O(n log n) in every case including adversarial input, which is a guarantee quicksort cannot make.

Best O(n log n)Average O(n log n)Worst O(n log n)Space O(n)StableNeeds extra memory
Loading the merge sort engine…

Where to go next