Introsort

Introsort, or introspective sort is a sorting algorithm that initially uses quicksort, but switches to heap sort if the depth of the recursion is too deep to eliminate the worst-case, and uses insertion sort for small cases because of its good locality of reference.

This algorithm has a worst-case optimal running time of $$O(n \log n)$$.

Reference: Introsort