Algorithms and Data Structures · Senior · Question 58 of 75

Why is the recursion depth of quicksort a concern, and how is it bounded?

Explanation

Recursing into the smaller partition and looping over the larger one guarantees O(log n) stack depth even when the time degrades. Introsort also caps depth and switches to heapsort.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 58

Test yourself

Take the Algorithms and Data Structures · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz