Tutorial 2, Design and Analysis of Algorithms, 2024
Tutorial 2, Design and Analysis of Algorithms, 2024
1. A fair coin is flipped n times. Let Xi j , with 1 ≤ i < j ≤ n, be 1 if the ith and jth flip landed on
the same side; let Xi j = 0 otherwise. Prove that Xi j are pairwise independent, but not 3−wise
independent.
Random variables X1 , X2 , ..., Xn are pairwise independent if ∀i ̸= j and ∀a, b
Pr((Xi = a) ∧ (X j = b)) = Pr(Xi = a)Pr(X j = b)
Random variables X1 , X2 , ..., Xn are 3−wise independent if ∀i ̸= j ̸= k and ∀a, b, c
Pr((Xi = a) ∧ (X j = b) ∧ (Xk = c)) = Pr(Xi = a)Pr(X j = b)Pr(Xk = c)
1
E[Y 2 ] − E[Y ]2
(a) Pr[Y = 0] ≤ .
E[Y ]2
E[Y ]2
(b) ≤ Pr[Y ̸= 0] ≤ E[Y ]. Use Jensen’s inequality E[Y |Y ̸= 0]2 ≤ E[Y 2 |Y ̸= 0].
E[Y 2 ]
7. Suppose you are provided with a source of unbiased random bits. How will you generate a
2 3
sample from the set 0, 1 with probability distribution Pr[0] = and Pr[1] = .
5 5
8. Let X and Y be numbers that are chosen independently and uniformly at random from
{ 0, 1, . . . , n }. Let Z be their sum modulo n + 1. Show that X,Y, and Z are pairwise in-
dependent but not independent.
9. There are three gift boxes, two of them have stones, and one of them has gold. You have
to choose one of them. After your choice, I will open one box having stones (out of the
remaining two boxes). Now you hve a choice: either stay with your original choice or flip
your choice (choose the other unopened box). Which deterministic strategy is better: always
stay with your original choice or always flip your choice (or it makes no difference)? Now
consider a randomized strategy R(p) in which you flip your choice with probability p. Find
the optimal randomized strategy R(p).
Random_Experiment(Integer n)
(1) Let the n−tuple I be given as I = ( j)nj=1 = (1, 2, . . . n − 1, n).
(2) Let R be a random permutation (with uniform probability) of I.
(3) Integer m = 0
(4) for i = 1 to n do
(5) if Ri > m
(6) m = Ri
Find the expected number of times the line (6) is executed as a function of n.