Starts with Quicksort but monitors recursion depth; switches to Heapsort when depth exceeds 2⌊log₂ n⌋ to guarantee O(n log n) worst-case, and finishes sub-arrays smaller than a fixed threshold with Insertion sort.
Combines the practical speed of Quicksort, the worst-case safety of Heapsort, and the low overhead of Insertion sort for small inputs, the foundation of std::sort in most C++ standard libraries.