Quick_select_and_finding_value_of_function
Quick_select_and_finding_value_of_function
Where S<x and S>x are the sets consisting of all those elements that are respectively smaller and greater
than the element x. Observe that the running time of the above algorithm is dominated by the number of
comparisons performed. Therefore, in order to get a bound on the expected running time of the algorithm,
our aim is essentially to find out the expected number of comparisons performed in Rand-QSelect(k, S).
Prove the following statements.
2. There are elements in set S which will be compared expected Θ(log n) times during the algorithm.
The only way we have for evaluating F is to use a lookup table that stores the values of F . Unfor-
tunately, an Evil Adversary has changed the value of 1/5 of the table entries when we were not looking.
Describe a simple randomized algorithm that given an input z, outputs a value that equals F (z) with
probability at least 1/2. Your algorithm should work for every value of z, regardless of what values the
Adversary changed. Your algorithm should use as few lookups and as little computation as possible.
Suppose I allow you to repeat your initial algorithm k times. What should you do in this case, and
what is the probability that your enhanced algorithm returns the correct answer?