study group randomized algorithms
Embed Size (px)
DESCRIPTION
Study Group Randomized Algorithms. Jun 7, 2003 Jun 14, 2003. Randomized Algorithms. A randomized algorithm is defined as an algorithm that is allowed to access a source of independent, unbiased random bits, and it is then allowed to use these random bits to influence its computation. Output.  PowerPoint PPT PresentationTRANSCRIPT

Study GroupRandomized AlgorithmsJun 7, 2003Jun 14, 2003

Randomized AlgorithmsA randomized algorithm is defined as an algorithm that is allowed to access a source of independent, unbiased random bits, and it is then allowed to use these random bits to influence its computation.InputOutputAlgorithmRandom bits

Monte Carlo and Las VegasThere are two kinds of randomized algorithms:Monte Carlo: A Monte Carlo algorithm runs for a fixed number of steps for each input and produces an answer that is correct with a bounded probabilityLas Vegas: A Las Vegas algorithm always produces the correct answer, but its runtime for each input is a random variable whose expectation is bounded.

QuestionIs the maxcut algorithm that we discussed previously a Monte Carlo or Las Vegas algorithm?
We will see two other examples today.

Randomized Quick SortIn traditional Quick Sort, we will always pick the first element as the pivot for partitioning.The worst case runtime is O(n2) while the expected runtime is O(nlogn) over the set of all input.Therefore, some input are born to have long runtime, e.g., an inversely sorted list.

Randomized Quick SortIn randomized Quick Sort, we will pick randomly an element as the pivot for partitioning.The expected runtime of any input is O(nlogn).

Analysis of Randomized QSLet s(i) be the ith smallest element in the input list S.Xij is a random variable such that Xij = 1 if s(i) is compared with s(j); Xij = 0 otherwise.Expected runtime t of randomized QS is:
E[Xij] is the expected value of Xij over the set of all random choices of the pivots, which is equal to the probability pij that s(i) will be compared with s(j).

Analysis of Randomized QSWe can represent the whole sorting process by a binary tree T:
Notice that s(i) will be compared with s(j) where i

Analysis of Randomized QSTherefore, the expected runtime t:
Note that
Randomized QS is a Las Vegas algorithm.

Randomized MincutGiven an undirected, connected multigraph G(V,E) , we want to find a cut (V1,V2) such that the number of edges between V1 and V2 is minimum.This problem can be solved optimally by applying the maxflow mincut algorithm O(n2) time by trying all pairs of source and destination.

Randomized MincutIn randomized Mincut, we repeatedly do the following:Pick randomly an edge e(u,v). Merge u and v, and remove all the edges between u and v. For example:
until there are only 2 vertices left. We will report the cut between these 2 vertices as the mincut.uvxyzu,vxyz

Analysis of Randomized MincutLet k be the mincut of the given graph G(E,V) where V=n.Then E kn/2.The probability q1 of picking one of those k edges in the first merging step 2/nThe probability p1 of not picking any of those k edges in the first merging step (12/n)Repeat the same argument for the first n2 merging steps.Probability p of not picking any of those k edges in all the merging steps (12/n)(12/(n1))(12/(n2))(12/3)

Analysis of Randomized MincutTherefore, the probability of finding the mincut:
If we repeat the whole procedure n2/2 times, the probability of not finding the mincut is at most Randomized Mincut is a Monte Carlo Algorithm.

QuestionWhat will happen if we apply a similar approach to find the maxcut instead? Will it be better or worse than the previous method of random assignment?

Complexity ClassesThere are some interesting complexity classes involving randomized algorithms:Randomized Polynomial time (RP)Zeroerror Probabilistic Polynomial time (ZPP)Probabilistic Polynomial time (PP)Boundederror Probabilistic Polynomial time (BPP)

RPDefinition: The class RP consists of all languages L that have a randomized algorithm A running in worstcase polynomial time such that for any input x in *:

RPIndependent repetitions of the algorithms can be used to reduce the probability of error to exponentially small.Notice that the success probability can be changed to an inverse polynomial function of the input size without affecting the definition of RP. Why?

ZPPDefinition: The class ZPP is the class of languages which have Las Vegas algorithms running in expected polynomial time.
ZPP = RP coRP. Why?(Note that a language L is in coX where X is a complexity class if and only if its complement *L is in X.)

PPDefinition: The class PP consists of all languages L that have a randomized algorithm A running in worstcase polynomial time such that for any input x in *:

PPTo reduce the error probability, we can repeat the algorithm several times on the same input and produce the output which occurs in the majority of those trials.However, the definition of PP is quite weak since we have no bound on how far from the probabilities are. It may not be possible to use a small number (e.g., polynomial no.) of repetitions to obtain a significantly small error probability.

QuestionConsider a randomized algorithm with 2sided error as in the definition of PP. Show that a polynomial no. of independent repetitions of this algorithm needs not suffice to reduce the error probability to . (Hint: Consider the case where the error probability is  n . )

BPPDefinition: The class BPP consists of all languages L that have a randomized algorithm A running in worstcase polynomial time such that for any input x in *:

BPPFor this class of algorithms, the error probability can be reduced to n with only a polynomial number of iterations.In fact, the probability bounds and can be changed to +1/p(n) and 1/p(n) respectively where p(n) is a polynomial function of the input size n without affecting the definition of BPP. Why?