



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: JaJa; Class: MATH FNDTN COMPTR ENGR; Subject: Electrical & Computer Engineering; University: University of Maryland; Term: Unknown 1989;
Typology: Assignments
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Since H IRE -ASSISTANT always hires candidate 1, it hires exactly once if and only if no candidates other than candidate 1 are hired. This event occurs when candidate 1 is the best candidate of the n ,
HIRE -ASSISTANT hires n times if each candidate is better than all those who were interviewed (and hired) before. This event occurs precisely when the list of ranks given to the algorithm is
Another way to think of the hat-check problem is that we want to determine the expected number
divide by n! to determine the average number of fixed points per permutation. This would be a painstaking process, and the answer would turn out to be 1. We can use indicator random variables, however, to arrive at the same answer much more easily.
Define a random variable X that equals the number of customers that get back their own hat, so
X i = I {customer i gets back his own hat}. Then X = X 1 + X 2 +· · · + X n. Since the ordering of hats
Thus,
1
1
1
n i i n i i n i
=
=
=
and so we expect that exactly 1 customer gets back his own hat.
Note that this is a situation in which the indicator random variables are not independent. For example, if n = 2 and X 1 = 1, then X 2 must also equal 1. Conversely, if n = 2 and X 1 = 0, then
expectation holds. Thus, we can use the technique of indicator random variables even in the presence of dependence.
Let X be the the random variable denoting the total number of inverted pairs in the array, so that 1 1 1
n n
− = = +
= (^) ∑ ∑.
We want the expected number of inverted pairs, so we take the expectation of both sides of the above equation to obtain 1 1 1
n n
− = = +
∑ ∑.
We use linearity of expectation to get 1 1 1 1 1 1 1 1 1
n n i j i ij n n i j i ij n n i j i
− = = + − = = + − = = +
∑ ∑
∑ ∑
∑ ∑
P ERMUTE -BY-CYCLIC chooses offset as a random integer in the range 1 ≤ offset ≤ n , and then it
origin indexing. If we had used 0-origin indexing instead, the index calculation would have