Multiple choice problems:

  1. The "select" problem for order statistics discussed in the first lecture is

    A. to determine the median of 5 elements.

    B. to determine the k-th smallest element in an array for given array and k.

    C. To choose a "Comparator" function to use on the median problem.

    D. to determine the ripest apple in a barrel. lecture 1

    Ans: B

  2. In the first lecture we discussed two algorithms for finding the max element of an array. Let S denote the sequential version: At each step compare previous max to next elt. Let T denote the "tournament" approach: At each phase do comparisons on parings. One from each paring advances to the next phase.

    A. Algorithm S uses fewer element comparisons that algorithm T.

    B. Algorithm S uses n-1 element comparisons and algorithm T uses n lg(n).

    C. Both A and B

    D. Neither A nor B

    Ans: D. Both use n-1 comparisons (which is also optimal for the problem).

  3. Which is true of the divide and conquer algorithm to the "select k-th largest" problem

    A. It leaves the array in sorted order.

    B. It rearranges the array somewhat.

    C. It uses a "partition" function to divide the array exactly in half if the array size is even and into two segments whose sizes differ by one if the array size is odd.

    D. It uses O(n lg(n)) array element comparisons.

    Ans: B or D must be marked correct. The question writer messed up, probably had Theta, not bigOh, in mind for D. A is wrong because it does not sort completely and C is wrong because the partitioning is not so exact (unfortunately).