Worksheet AB26.2 - QuickSort2
Worksheet AB26.2 - QuickSort2
2 1
Worksheet AB26.2
QuickSort2
1. Practice sorting the following data using quickSort. First, determine the values for
midIndex and dividingValue assuming that the first item is at index zero. Then, write the
correct sequence of integers in the list after each swap has been made - until the code
makes its first recursive call.
28 42 69 8 100 33 36 3 84 21 40 5
[3, 5, 21, 8, 28, 33, 36, 100, 84, 69, 40, 42]
[3, 5, 8, 21, 28, 33, 36, 100, 84, 69, 40, 42]
[3, 5, 8, 21, 28, 33, 36, 42, 84, 69, 40, 100]
[3, 5, 8, 21, 28, 33, 36, 42, 40, 69, 84, 100]
[3, 5, 8, 21, 28, 33, 36, 40, 42, 69, 84, 100]
2. After determining the values for midIndex and dividingValue assuming that the first item
is at index zero, write the correct sequence of words in the list after each swap has been
made - until the code makes its first recursive call (as you did in #1 above with integers).
[sort, these, made, using, quicksort, until, a, recursive, call, is, words]
[sort, these, made, is, quicksort, until, a, recursive, call, using, words]
Java Curriculum for AP Computer Science, Worksheet AB26.2 2
[sort, these, made, is, quicksort, call, a, recursive, until, using, words]
[a, these, made, is, quicksort, call, sort, recursive, until, using, words]
[a, call, made, is, quicksort, these, sort, recursive, until, using, words]
[a, call, is, made, quicksort, these, sort, recursive, until, using, words]
[a, call, is, made, quicksort, recursive, sort, these, until, using, words]