# 随机算法 (Spring 2013)/Problem Set 2

• 注意写明自己的姓名与学号。
• 必须包含完整的解题过程，中英文不限。

## Problem 1

(Due to Karp)

Consider a bin containing ${\displaystyle d}$ balls chosen at random (without replacement) from a collection of ${\displaystyle n}$ distinct balls. Without being able to see or count the balls in the bin, we would like to simulate random sampling with replacement from the original set of ${\displaystyle n}$ balls. Our only access to the balls in that we can sample without replacement from the bin.

(Spoiler alert: You may want to stop here for a moment and start thinking about the solution before proceeding to read the following part.)

Consider the following strategy. Suppose that ${\displaystyle k balls have been drawn from the bin so far. Flip a coin with probability of HEADS being ${\displaystyle k/n}$. If HEADS appears, then pick one of the ${\displaystyle k}$ previously drawn balls uniformly at random; otherwise, draw a random ball from the bin. Show that each choice is independently and uniformly distributed over the space of the ${\displaystyle n}$ original balls. How many times can we repeat the sampling?

## Problem 2

(Due to Karger and Motwani)

• Let ${\displaystyle S,T}$ be two disjoint subsets of a universe ${\displaystyle U}$ such that ${\displaystyle |S|=|T|=n}$. Suppose we select a random set ${\displaystyle R\subseteq U}$ by independently sampling each element of ${\displaystyle U}$ with probability ${\displaystyle p}$. We say that the random sample ${\displaystyle R}$ is good if the following two conditions hold: ${\displaystyle R\cap S=\emptyset }$ and ${\displaystyle R\cap T\neq \emptyset }$. SHow that for ${\displaystyle p=1/n}$, the probability that ${\displaystyle R}$ is good is larger than some positive constant.
• Suppose now that the random set ${\displaystyle R}$ is chosen by sampling the elements of ${\displaystyle U}$ with only pairwise independence. Show that for a suitable choice of the value of ${\displaystyle p}$, the probability that ${\displaystyle R}$ is good is larger than some positive constant. (Hint: Use the second moment.)
(The hint for the second question was wrong. The second question is now optional and use whatever tools you can come up with.)

## Problem 3

1. Generalize the LazySelect algorithm for the ${\displaystyle k}$-selection problem: Given as input an array of ${\displaystyle n}$ distinct numbers and an integer ${\displaystyle k}$, find the ${\displaystyle k}$th smallest number in the array.
2. Use the Chernoff bounds instead of Chebyshev's inequality in the analysis of the LazySelect Algorithm and try to use as few random samples as possible.

## Problem 4

(Generalization of Chernoff bound to the sum of geometric random variables.)

Let ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ be independent geometrically distributed random variables each having expectation 2 (each of the ${\displaystyle X_{i}}$ is an independent experiment counting the number of tosses of an unbiased coin up to and including the first HEADS). Let ${\displaystyle X=\sum _{i=1}^{n}X_{i}}$ and ${\displaystyle \delta }$ be a positive real constant. Use the moment generating functions to derive the best upper bound you can give on ${\displaystyle \Pr[X>(1+\delta )(2n)]}$.