CPSC 220
Fall 2006
HW 4: Quicksort
Read the section on Quicksort in the text (p. 351). Now
consider the array a of integers below:
6 4 8 3 7 2 10 9 5
Assuming you have called quickSort(a, 0, 8), using
the quickSort method as written on page 352, show the following:
- A trace of the first call to findPartition. Show the values of
partitionelement, left,
right, data[left] and data[right] as you proceed through the while
loop and its two inner loops.
- The value of indexofpartition when findPartition returns.
- The parameters that are passed to the first top-level recursive call
to quickSort.
- The parameters that are passed to the second top-level recursive call
to quickSort.