Processing math: 100%

Exercise 5.3-5

Prove that in the array P in procedure PERMUTE-BY-SORTING, the probability that all elements are unique is at least 11n.

Let Xi be an indicator random variable for the event that P[i] is not unique. P[i] being unique means that it holds a different value from the values found in P[1,,i1] which has at most i1 distinct elements and so we have Pr{Xi}=E[Xi]i1n3. Let X be a random variable for the event that P holds at least one duplicate element. This gives us

X=(X1X2Xn)=X1+X2++Xn.

We can then calculate

E[X]=E[ni=1Xi]=ni=1E[Xi]ni=1i1n3=1n3n1i=0i=1n3(n1)n2 //(arithmetic series)=n12n21n

And so the probability that all elements in P are unique is E[ˉX]=1E[X]11n.