CS 241, Spring 2003: HW 3 Practice Problems


  1. Prove the best lower bound you can (using the decision tree technique) on the time complexity of the problem of finding the minimum value and the maximum value in an array A with n distinct elements under the model of computation in which you can only access elements from array A by asking if A[i] < A[j] for i and j integers from 0 to n-1.

    solution

  2. Prove the best lower bound you can (using the decision tree technique) on the time complexity of the problem of computing which elements in a SORTED array A are less than a given element x under the model of computation in which you can only access A by asking if A[i] < A[j] or A[i] < x, for i and j integers from 0 to n-1. You can assume that the array is sorted with the minimum element in A[0] and the maximum element in A[n-1] but of course it doesn't matter if it is in increasing or decreasing order in terms of answering the problem.

    solution

  3. Prove the best lower bound you can (using the decision tree technique) for the number of comparisons required by a comparison based algorithm to merge a sorted list of n items with a sorted list of 2 items.

    solution

  4. Suppose you are given the task to sort 100,000 social security numbers (each is a 9 digit number). You have decided to use radix sort for this problem and want to decide how many base-10 digits to use for each radix sort digit. Which is best
    
      (a) 1 base-10 digit per radix sort digit, or
    
      (b) 3 base-10 digits per radix sort digit, or
    
      (c) one radix sort digit of 4 base-10 digits and the other radix sort
           digit of 5 base-10 digits
    
    You are provided with a counting sort procedure with exact time complexity of 5n+4k where n is the number of elements being sorted and k is the number of possible values for the elements. Show your work.

    solution