Explain how to implement the algorithm PERMUTE-BY-SQRTING to handle the case in which two or more priorities are identical. That is, your algorithm should produce a uniform random permutation, even if two or more priorities are identical ordering of the values in positions 1 through i ‒ 1, whereas Bi depends only on whether the value in position i is greater than all the values 1 through i ‒ 1. The ordering of positions 1 through i ‒ 1 does not affect whether i is greater than all of them, and the value of i does not affect the ordering of positions 1 through i ‒ 1. Thus we can apply equation (C.15) to obtain
Pr{Si} =Pr{Bi∩Oi} = Pr{Bi}=Pr{Oi}.
The probability Pr {Bi} is clearly l/n, since the maximum is equally likely to be in any one of the n positions. For event Oi to occur, the maximum value in positions 1 through i ‒ 1 must be in one of the firstk positions, and it is equally likely to be in any of these i - 1 positions. Consequently, Pr{Oi} =k/(i ‒ 1) and Pr {Si} = k/(n(i ‒ 1)). Using equation (5.13), we have

We approximate by integrals to bound this summation from above and below. By the inequalities (A. 12), we have

Evaluating these definite integrals gives us the bounds

which provide a rather tight bound for Pr{S}. Because we wish to maximize our probability of success, let us focus on choosing the value of k that maximizes the lower bound on Pr {S}. (Besides, the lower-bound expression is easier to maximize than the upper-bound expression.) Differentiating the expression (k/n)(Inn‒ Ink) with respect to k, we obtain

Setting this derivative equal to 0, we see that the lower bound on the probability is maximized when Ink = In n ‒ 1 = In(n/e) or, equivalently, when k = n/e, Thus, if we implement our strategy with k = n/e, we will succeed in hiring our best-qualified applicant with probability at least 1/e.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.