# Randomized Algorithms (Spring 2010)/Problem Set 1

## Problem 1 (10 points)

[MR]-1.1

• Suppose that you are given a coin for which the probability of HEADS, say ${\displaystyle p}$, is unknown. How can you use this coin to generate unbiased (i.e., ${\displaystyle \Pr[\mathrm {HEADS} ]=\Pr[\mathrm {TAILS} ]=1/2}$) coin-flips? Give a scheme for which the expected number of flips of the biased coin for extracting one unbiased coin-flip is no more than ${\displaystyle {\frac {1}{p(1-p)}}}$.
(Hint: Consider two consecutive flips of the biased coin.)
• (Bonus problem) Devise an extension of the scheme that extracts the largest possible number of independent, unbiased coin-flips from a given number of flips of the biased coin.

## Problem 2 (10 points)

The original Karger's algorithm returns a min-cut with probability ${\displaystyle \geq {\frac {2}{n(n-1)}}}$ after ${\displaystyle n-2}$ contractions. We have seen that by running the original Karger's algorithm for multiple times, the probability of success can be improved. Consider the following variation. Starting with a graph with ${\displaystyle n}$ vertices, first contract the graph down to ${\displaystyle k}$ vertices using Karger's algorithm. Make ${\displaystyle \ell }$ copies of the graph with ${\displaystyle k}$ vertices, and now run Karger's algorithm independently on these ${\displaystyle \ell }$ copies. Return the smallest returned cut of these ${\displaystyle \ell }$ instances.

• What is the total number of contractions?
• What is the probability of finding a min-cut?
• Try to optimize the probability of success subject to the constraint of using no more than ${\displaystyle 2n}$ contractions.

## Problem 3 (10 points)

Recall the following definitions:

 Definition 2: The class NP consists of all decision problems ${\displaystyle f}$ that have a polynomial time deterministic algorithm ${\displaystyle V}$ such that for any input ${\displaystyle x}$, ${\displaystyle f(x)=1}$ if and only if ${\displaystyle \exists y}$, ${\displaystyle V(x,y)=1}$, where the size of ${\displaystyle y}$ is within polynomial of the size of ${\displaystyle x}$.

 Definition 4: The class ZPP consists of all decision problems ${\displaystyle f}$ that have a randomized algorithm ${\displaystyle A}$ running in expected polynomial time for any input such that for any input ${\displaystyle x}$, ${\displaystyle A(x)=f(x)}$.

 Definition 5: The class RP 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/2}$; if ${\displaystyle f(x)=0}$, then ${\displaystyle \Pr[A(x)=0]=1}$.

Prove that ZPP${\displaystyle \subseteq }$NP and RP${\displaystyle \subseteq }$NP.

(Hint: Notice that a randomized algorithm ${\displaystyle A}$ on input ${\displaystyle x}$ can be represented as a deterministic algorithm ${\displaystyle D}$ with two inputs: ${\displaystyle x}$ and a sequence ${\displaystyle s}$ of random bits.)

## Problem 4 (10 points)

A parallel computer consists of ${\displaystyle n}$ processors and ${\displaystyle n}$ memory modules. During a step, each processor sends a memory request to one of the memory modules, and each memory modul answer the request if it receives exactly one request. Note that a memory module may receive more than one requests. There are two schemes for dealing with conflicted memory requests:

1. Upon receiving more than one requests, a memory module does not answer any request.
2. Upon receiving more than one requests, a memory module answers one of the received requests.

Assuming that each processor sends a request to a memory module chosen uniformly and independently at random:

(a) with the first scheme, what is the expected number of processors whose requests are answered?
(b) with the second scheme, what is the expected number of processors whose requests are answered?
(c) We upgrade the memory of the machine, so that a memory module that receives either one or two requests can answer its request(s); modules that receive more than two requests will answer two requests and discard the rest. What is the expected number of processors whose requests are answered?

(You may assume the approximation ${\displaystyle \left(1-{\frac {1}{n}}\right)^{n}\approx {\frac {1}{e}}}$.)