Exercise 7.1-4

How would you modify QUICKSORT to sort in nonincreasing order?

All that needs to be changed is line 4 of the PARTITION subroutine:

if A[j] ≤ x

becomes:

if A[j] ≥ x

and then QUICKSORT will sort in nonincreasing order.