CS230 - Assignment 3.2

  1. Consider the problem of finding the median of three orderable elements A, B, and C
    1. Design an optimal algorithm to find the median.
    2. Assuming that each input permutation is equally likely, how many comparisons does your algorithm take on average?
    3. Use posets to show that your algorithm has optimal worst cost.
       
  2. Consider the input list 1 8 7 5 4 1 3 6
    1. Show the Binomial Tree which would be constructed by the BuildBinomialTree algorithm.
    2. Which element in the tree are candidates for 2nd Max?
       
  3. Consider the problem of determining if at least three of five integer values are non-zero using only the operation of testing equality with zero.  Give an adversary strategy to force ANY algorithm to examine all of the five values.