Tuesday, April 15, 2014

clrs Exercise 5.2-2

Ref http://clrs.skanev.com/05/02/02.html
5.2-2
In HIRE-ASSISTANT, assuming that the candidates are presented in a random order,
what is the probability that you hire exactly twice?
You hire twice when you first hire is the candidate with rank i and all the candidates with rank k>i come after the candidate with rank n. There are ni better suited candidates and the probability of the best one coming first is 1/(ni) (we can ignore the other candidates and they don't affect the probability). Thus, the probability for hiring twice if your first candidate has rank i is:
Pr{Ti}=1n1ni
The first part reflects the probability of picking that particular candidate out of n.
The probability to hire twice is:
Pr{T}=n1i=1Pr{Ti}=n1i=11n1ni=1nn1i=11i=1n(lg(n1)+O(1))



No comments:

Post a Comment