(i) A list of twelve numbers is to be sorted into ascending order.
28 18 50 27 48 8 25 12 56 31 33 42
(a) Use a quick sort to obtain the sorted list. You should show the result of each pass and identify your pivots clearly.
(b) Show how the binary search algorithm is used to try to locate the number 40 in the list. You must clearly indicate your choice of pivots and which part of the list you are rejecting.
(ii) A different list of nine distinct integers is to be sorted into descending order.
23 20 x 32 15 8 19 6 22
The list is sorted using bubble sort. The first three passes are
23 20 32 x 15 19 8 22 6
23 32 20 x 19 15 22 8 6
32 23 20 19 x 22 15 8 6
Determine the range of possible values of .