Scans the input for naturally ordered runs, uses Insertion sort to extend any run shorter than a minimum length (minrun), then merges runs from a stack using a strategy that keeps stack heights balanced.
Adaptive, the more existing order the input has, the fewer merges are needed, approaching O(n) on nearly-sorted data; this is why it was chosen as the standard library sort for CPython and Java.