Sunteți pe pagina 1din 2

R

IS

UN

Dr. Surender Baswana

FR 6.2 Informatik

E R SIT

I N F O R M A T I K

SA

Universitat
des
Saarlandes

IV

A VIE N

WS 2004/5

Exercises for Randomized Algorithms


2. Assignment

Due : 6 December

Exercise 1 (4,0)
(one more ball-bin experiment)
Consider the following process (experiment). There are n bins and n players, and each player has an infinite
supply of balls. The bins are all initially empty. We have a sequence of rounds : in each round, each player
throws a ball into an empty bin chosen independently at random from all currently empty bins. The experiment
stops as soon as there is no empty bin left. Let Z be the number of rounds in the process.
a) Determine the expected value of Z .
b) (Optional) What can you say about the tail of Z s distribution, that is, can you prove that Z is concentrated
around its mean ?
Exercise 2 (4,1)
(witness of shortest paths)
Consider an undirected unweighted graph G on n vertices. For simplicity, assume that G is connected. Suppose
we are given a partial distance matrix M : For a pair of vertices i; j , M i; j stores exact distance if i and j
are separated by distance  n, otherwise M stores a symbol
indicating that M i; j is greater than n.
2
Unfortunately, there are  n entries in the matrix storing .

( )

a) We are given the graph G and the partial distance matrix M . Design a Monte Carlo algorithm to compute
the distance matrix for G in time O n2
n . (Each entry of the distance matrix has be correct with
=n2 ).
probability exceeding

1 1

( log )

Following idea may be useful : Consider a BFS tree Bv rooted at a vertex v in G. Since the graph is
undirected unweighted, Bv stores distances from v to all the other vertices (level of a vertex in the BFS
tree is its distance from v ). Also if v lies on a shortest path between two vertices x and y , then sum of
levels of x and y is the distance between x and y . In other words, the BFS tree Bv is a witness of shortest
path for all pairs of vertices that have a shortest path with v as an intermediate vertex.
For this exercise, find a small set of witnesses using random sampling and proceed ...
b) Design a Monte carlo algorithm with same running time if the given graph is directed.
Hint : Construct a graph Gr that is same as G except that each edge direction is reversed. Use two BFS
trees at a vertex as witness.
Exercise 3 (0,3,3)
(computing distance in a small neighborhood)
V; E , let Sp  V be a set formed by selecting each vertex
Given an undirected unweighted graph G
independently with probability p. Let Nv 2 Sp be the vertex that is nearest to v among all vertices of the
sample set Sp . Let dv be the distance between v and Nv .

=(

( )

a) (Optional) Design an O m time algorithm to compute Nv and dv for all the vertices. For the remaining
parts of the exercise, you may assume such an algorithm.

b) Ball v; Sp is the set of vertices in the graph that are lying within distance dv
from v . Show that
expected size of Ball v; Sp is =p.
Hint : Express the number of vertices in Ball v; Sp as a sum of suitable random variables.

) 1

c) Design an algorithm to compute Ball v; Sp for all the vertices v 2 V nSp in expected time pn2 .
Hint : From vertex v , build a BFS tree that spans Ball v; S . For this purpose, perform restricted BFS
traversal in which we stop as soon as all the vertices of Ball v; Sp have been visited. Show that it would
take expected O p12 time to build Ball v; Sp .

( )

( )
(

1
2

dv
dv

Nv

Ball v; Sp

sampled vertex
tree edge

Figure 1.

S-ar putea să vă placă și