# Randomized Algorithms (Spring 2010)/Problem Set 2

## Problem 1 (10 points)

Some known facts:

• Balls-into-bins: ${\displaystyle m}$ balls are uniformly and independently thrown to ${\displaystyle n}$ bins. If ${\displaystyle m=\Theta (n)}$, then the maximum load is ${\displaystyle \Theta \left({\frac {\ln n}{\ln \ln n}}\right)}$ with high probability.
• Power of two choices: ${\displaystyle m}$ balls are sequentially thrown to ${\displaystyle n}$ bins. For each ball, choose two uniform random bins, and throw the ball to the current less loaded bin among the two chosen bins. Assuming that ${\displaystyle m=\Theta (n)}$, after all ${\displaystyle m}$ balls are thrown to bins, the maximum load is ${\displaystyle \Theta \left(\ln \ln n\right)}$ with high probability.

Questions: Assume ${\displaystyle n}$ balls and ${\displaystyle n}$ bins. We throw the ${\displaystyle n}$ balls sequentially.

1. If we throw the first ${\displaystyle {\frac {n}{2}}}$ balls uniformly and then throw the rest balls as the way of power-of-two-choices, what is the asymptotic maximum load with high probability?
2. For the ${\displaystyle k}$th ball, if ${\displaystyle k}$ is even, we throw the ball to a uniform bin; and if ${\displaystyle k}$ is odd, we throw the ball as the way of power-of-two-choices. What is the asymptotic maximum load with high probability?

## Problem 2 (10 points)

Suppose that we flip a fair coin ${\displaystyle n}$ times to obtain ${\displaystyle n}$ random bits. Consider all ${\displaystyle m={n \choose 2}}$ pairs of these bits in some order. Let ${\displaystyle Y_{i}}$ be the exclusive-or of the ${\displaystyle i}$th pair of bits, and let ${\displaystyle Y=\sum _{i=1}^{m}Y_{i}}$ be the number of ${\displaystyle Y_{i}}$ that equal 1.

1. Show that the ${\displaystyle Y_{i}}$ are NOT mutually independent.
2. Show that the ${\displaystyle Y_{i}}$ satisfy the property ${\displaystyle \mathbf {E} [Y_{i}Y_{j}]=\mathbf {E} [Y_{i}]\mathbf {E} [Y_{j}]}$.
3. Compute ${\displaystyle \mathbf {Var} [Y]}$.
4. Using Chebyshev's inequality, prove a bound on ${\displaystyle \Pr[|Y-\mathbf {E} [Y]|\geq n]}$.

## Problem 3 (10 points)

The class BPP (for Bounded-error Probabilistic Polynomial time) is defined as follows:

 Definition: The class BPP consists of all decision problems ${\displaystyle f}$ that have a randomized algorithm ${\displaystyle A}$ running in worst-case polynomial time such that for any input ${\displaystyle x}$, if ${\displaystyle f(x)=1}$, then ${\displaystyle \Pr[A(x)=1]\geq 1-1/4}$; if ${\displaystyle f(x)=0}$, then ${\displaystyle \Pr[A(x)=0]\geq 1-1/4}$.

We can generalize this definition to other value of errors and define the parameterized classes BPP${\displaystyle (\epsilon )}$.

 Definition: The class BPP${\displaystyle (\epsilon )}$ consists of all decision problems ${\displaystyle f}$ that have a randomized algorithm ${\displaystyle A}$ running in worst-case polynomial time such that for any input ${\displaystyle x}$, if ${\displaystyle f(x)=1}$, then ${\displaystyle \Pr[A(x)=1]\geq 1-\epsilon }$; if ${\displaystyle f(x)=0}$, then ${\displaystyle \Pr[A(x)=0]\geq 1-\epsilon }$.

So the original BPP is actually BPP${\displaystyle (1/4)}$.

• Prove that BPP${\displaystyle (\epsilon )}$ is the same for all ${\displaystyle {\frac {1}{2^{n}}}\leq \epsilon \leq {\frac {1}{2}}-{\frac {1}{p(n)}}}$, for a polynomial ${\displaystyle p(n)}$ of the input size ${\displaystyle n}$.

The solution of this problem gives a very simple scheme for boosting the accuracy of Monte Carlo randomized algorithms with two-sided errors.

## Problem 4 (10 points)

Random sampling is expensive. Redesign the parameters of the LazySelect algorithm for median selection to sample as small number of elements as possible. Use the Chernoff bound to show that your algorithm finds the median of ${\displaystyle n}$ elements in linear time with high probability (${\displaystyle 1-o(1)}$).

For the convenience, you are allowed to ignore the effects of the floors (${\displaystyle \lfloor \cdot \rfloor }$) and ceilings (${\displaystyle \lceil \cdot \rceil }$).

## Problem 5 (10 points)

In many wireless communication systems, each receiver listens on a specific frequency. The bit ${\displaystyle b(t)}$ sent at time ${\displaystyle t}$ is represented by a ${\displaystyle 1}$ or ${\displaystyle -1}$. Unfortunately, noise from other nearby communications can affect the receiver's signal. A simplified model of this noise is as follows. There are ${\displaystyle n}$ other senders, and the ${\displaystyle i}$th has strength ${\displaystyle p_{i}\leq 1}$. At any time ${\displaystyle t}$, the ${\displaystyle i}$th sender is also trying to send a bit ${\displaystyle b_{i}(t)}$ that is represented by ${\displaystyle 1}$ or ${\displaystyle -1}$. The receiver obtains the signal ${\displaystyle s(t)}$ given by

${\displaystyle s(t)=b(t)+\sum _{i=1}^{n}p_{i}b_{i}(t)}$.

If ${\displaystyle s(t)>0}$, then the receiver assumes that the bit sent at time ${\displaystyle t}$ was 1; otherwise, the receiver assumes that it was -1.

Assume that all the bits ${\displaystyle b_{i}(t)}$ can be considered independent, uniform random variables. Give a Chernoff bound to estimate the probability that the receiver makes an error in determining ${\displaystyle b(t)}$.