3 ms·
Possibly better would be Timsort (used in Python, Java, V8, etc.), as it's "designed to take advantage of runs of consecutive ordered elements that already exis
by mkl 6y ago
Possibly better would be Timsort (used in Python, Java, V8, etc.), as it's "designed to take advantage of runs of consecutive ordered elements that already exist": https://en.wikipedia.org/wiki/Timsort https://en.wikipedia.org/wiki/Timsort
- eru 6y agoHaskell's standard library sort, a variant of merge sort, also makes use of runs. It runs in O(n log (number of runs)). It's quite a lot simpler than Timsort.