What is the cut-off for switching from quick sort to heap sort in the implementation of introsort?
What is the cut-off for switching from quick sort to heap sort in the implementation of introsort? Correct Answer 2 log (n)
Quicksort has a worst case time complexity of O(n2) which is not preferable. So in order to avoid worst case of quicksort, introsort switches to heap sort when the depth is greater than 2 log(n). This particular value has been deduced experimentally.
মোঃ আরিফুল ইসলাম
Feb 20, 2025