PROBLEM SET 1

Which of the following programs from the text are not stable sorts? sort3, selection, insertion, shellsort, bubblesort, quicksort?



Give a file of ten elements (use the letters A through J) that maximizes the number of times the if test succeeds in selection sort. (Also give the maximum value achieved.)



Show how the file A B A B A B A B A B A B is partitioned by Quicksort (give the result of partitioning and indicate precisely what subfiles are involved in the recursive calls), if the algorithm is implemented as described on page 120 in the text.



Extra Credit. Suppose that a file is 5-, 11-, and 14- ordered. What is the maximum number of elements that could be to the left of a given element and larger?



Due: Wednesday, February 14