Recursive Quicksort
Suppose we want to sort b[h..k]. Let�s use algorithm partition to make it look like this, where x is the value initially in b[h]:
What remains to be done in order to sort b[h..k]? Two things:
- Sort b[h..j-1]
- Sort b[j+1..k]
We present on the next slide a recursive version of quicksort --a version that calls itself. We don�t expect you to fully comprehend it, because recursion, the idea of a method calling itself is new to you. Later, we present a non-recursive version.