SortingExplained
Tim Sort
Finds natural runs, extends them with insertion sort, then merges.
Time
O(n log n), O(n) if sorted
Extra space
O(n)
Use it for
Real-world data; used by Python and Java.
Finds natural runs, extends them with insertion sort, then merges.
Time
O(n log n), O(n) if sorted
Extra space
O(n)
Use it for
Real-world data; used by Python and Java.