Randomized Algorithms: Prabhakar Raghavan IBM Almaden Research Center San Jose, CA
Randomized Algorithms: Prabhakar Raghavan IBM Almaden Research Center San Jose, CA
Prabhakar Raghavan
IBM Almaden Research Center
San Jose, CA.
{ Typeset by FoilTEX {
Deterministic Algorithms
INPUT
ALGORITHM
OUTPUT
{ Typeset by FoilTEX { 1
Randomized Algorithms
INPUT
ALGORITHM
OUTPUT
RANDOM NUMBERS
RANDOM NUMBERS
These probabilities/expectations
are only over the random
choices made by the algorithm
{ independent of the input.
Thus independent repetitions
of Monte Carlo algorithms drive
down the failure probability
exponentially.
{ Typeset by FoilTEX { 6
Advantages of randomized
algorithms
Simplicity
Performance
For many problems, a randomized
algorithm is the simplest, the
fastest, or both.
{ Typeset by FoilTEX { 7
Scope
Number-theoretic algorithms:
Primality testing (Monte Carlo).
Data structures: Sorting,
order statistics, searching,
computational geometry.
Algebraic identities: Polynomial
and matrix identity verication.
Interactive proof systems.
{ Typeset by FoilTEX { 8
Mathematical programming:
Faster algorithms for linear
programming. Rounding linear
program solutions to integer
program solutions.
Graph algorithms: Minimum
spanning trees, shortest paths,
minimum cuts.
Counting and enumeration:
Matrix permanent. Counting
combinatorial structures.
{ Typeset by FoilTEX { 9
Parallel and distributed computing:
Deadlock avoidance, distributed
consensus.
Probabilistic existence proofs:
Show that a combinatorial
object arises with non-zero
probability among objects drawn
from a suitable probability
space.
{ Typeset by FoilTEX { 10
Derandomization: First devise
a randomized algorithm, then
argue that it can be \derandomized"
to yield a deterministic algorithm.
{ Typeset by FoilTEX { 11
Game-tree evaluation
9
MAX
9 3
MIN MIN
7 9 3 17
1 7 9 5 3 2 17 12
MAX
9 3
MIN MIN
7 9 3 17
1 7 9 5 3 2 17 12
1 0
OR OR
0 1 0 0
1 0 1 1 1 0 1 0
{ Typeset by FoilTEX { 16
Analysis of tree evaluation
For an OR subtree evaluating
to 0, we must evaluate both
of its subtrees, incurring cost
2(3k;1).
Now consider the root AND:
(a) If it is 1, both OR subtrees
must evaluate to 1 expected
cost paid is twice above, = 3k.
(b) If it is 0, at least one OR
subtree evaluates to 0.
{ Typeset by FoilTEX { 17
Game tree analysis
k
Number of leaves in tree = 4 .
Thus expected cost of randomized
algorithm n0:793
{ Typeset by FoilTEX { 18
Lower bounds and the
minimax principle
{ Typeset by FoilTEX { 20
Minimax Principle
{ Typeset by FoilTEX { 21
Lower bound for game tree
evaluation
{ Typeset by FoilTEX { 22
NOR trees instead
{ Typeset by FoilTEX { 23
The input distribution
p
Let p = (3 ; 5)=2.
Claim: The value of any
node is 1 with probability p,
independent of all other nodes
at the same level.
Claim: Any deterministic
algorithm may as well determine
the value of one sub-tree of a
node, before inspecting any leaf
of its sibling sub-tree.
{ Typeset by FoilTEX { 24
The Analysis
{ Typeset by FoilTEX { 25
Exercise: Why is this lower
bound weak?
{ Typeset by FoilTEX { 26
The 2-SAT Problem
Given a set of boolean clauses
in CNF each containing two
literals, nd a satisfying assignment
if one exists.
(x1 + x4)(
x4 + x3)(x2 + x
3)
Start with any tentative assignment
If there is an unsatised
clause, pick one of its two
literals at random, and ip it.
{ Typeset by FoilTEX { 27
If no solution found in 2n2
steps, declare \none exists".
Monte Carlo: If a solution
exists, will nd it with probability
> 1=2.
If not, will always declare \none
exists".
{ Typeset by FoilTEX { 28
Random Walk Analysis
What is the probability of
missing a satisfying assignment
in 2n2 steps?
Fix any particular satisfying
assignment A.
Consider the number of literals
on which the algorithm's
tentative assignment agrees
with A.
{ Typeset by FoilTEX { 29
This is a random walk on the
integers that increases with
probability at least 1=2 at
each step.
Expected time to nd an
assignment < n2.
Markov's inequality ) probability
of missing an assignment in 2n2
steps is < 1=2.
{ Typeset by FoilTEX { 30
Binary planar partitions
L2 L1
L1
s1
L2 L3
s
3
s1 s3 s3 s
s 2
2
L3
{ Typeset by FoilTEX { 31
Autopartitions
{ Typeset by FoilTEX { 32
Analysis of autopartition size
v
1
u
v
2
Pr
u a v] 1=(index(u v)+1):
Thus the expected size of the
X X
tree constructed is
n+ Pr
u a v]
n+
X X 1
u v6=u
{ Typeset by FoilTEX { 35
Matrix product verication
{ Typeset by FoilTEX { 36
Simple randomized
algorithm
{ Typeset by FoilTEX { 38
Sources
R.M. Karp. An introduction to
randomized algorithms. Discrete
Applied Mathematics, 34:165{
201, 1991.
R. Motwani and P. Raghavan.
Randomized Algorithms. Cambridge
University Press, 1995.
D. J. A. Welsh. Randomised
algorithms. Discrete Applied
Mathematics, 5:133{145, 1983.
{ Typeset by FoilTEX { 39