DOC PREVIEW
UW-Madison COMPSCI 787 - Lecture 6 Randomized Algorithms

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS787: Advanced Algorithms Lecture 6: Randomized AlgorithmsIn this lecture we introduce randomized algorithms. We will begin by motivating the use of ran-domized algorithms through a few examples. Then we will revise elementary probability theory,and conclude with a fast randomized algorithm for computing a min-cut in a graph, due to DavidKarger.A randomized algorithm is an algorithm that can toss coins and take different actions dependingon the outcome of those tosses. There are two kinds of randomized algorithms that we will bestudying:• Las Vegas Algorithms: These refer to the randomized algorithms that always come up witha/the correct answer but may take longer in some cases than in others. Their “expected”running time is polynomial in the size of their input, which means that the average runningtime over all possible coin tosses is polynomial. In the worst case, however, a Las Vegasalgorithm may take exponentially long. One example of a Las Vegas algorithm is Quicksort:it makes some of its decisions based on coin-tosses, it always produces the correct result, andits expected running and worst-case running times are n log n and n2, respectively.• Monte Carlo Algorithms: These refer to the randomized algorithms that sometimes comeup with an incorrect answer. Like Las Vegas algorithms their expected running time ispolynomial but in the worst case may be exponential.We can usually “boost” the probability of getting a correct answer through a Monte Carloalgorithm to a value as small as we like by running it multiple times. For example, if aparticular Monte Carlo algorithm produces an incorrect result with probability 1/4, and wehave the ability to detect an incorrect result, then the probability of not obtaining a correctanswer after t independent runs is (1/4)t. In some contexts, such as in optimization problems,we do not have the ability to detect an incorrect answer, but can compare different answersand pick the best one. The same analysis still applies in these cases, because a poor answeroverall implies that we picked a poor answer in all of the independent runs. For this reasonwe are usually content with obtain a correct answer with probability 1 − c for some constantc < 1.6.1 MotivationRandomized algorithms have several advantages over deterministic ones. We discuss them here:• Simplicity. Often times randomized algorithms tend to be simpler than deterministic algo-rithms for the same task. For example, recall from Lecture 2 the problem of finding the kthsmallest element in an unordered list, which had a rather involved deterministic algorithm. Incontrast, the strategy of picking a random element to partition the problem into subproblemsand recursing on one of the partitions is much simpler.1• Efficiency. For some problems randomized algorithms have a better asymptotic runningtime than their deterministic counterparts. Indeed, there are problems for which the bestknown deterministic algorithms run in exponential time, while polynomial time randomizedalgorithms are known. One example is Polynomial Identity Testing, where given a n-variatepolynomial f of degree d over a field F , the goal is to determine whether it is identically zero.If f were univariate then merely evaluating f at d + 1 points in F would give us a correctalgorithm, as f could not have more that d roots in F . With n variables, however, there maybe dndistinct roots, and just picking dn+ 1 points in F gives us exponential time. While wedon’t know of a deterministic polytime algorithm for this problem, there is a simple algorithmthat evaluates f at only 2d points, based on a theorem by Zippel and Schwarz. The algorithmexploits the fact that the roots of the polynomial are roughly evenly scattered over space, sothat a random point is unlikely to be a root.Another example is the primality testing problem, where given an n-bit number, the goal isto determine if it is prime. While straightforward randomized algorithms for this problemexisted since the 70’s, which ran in polynomial time and erred only if the number was prime, itwas not known until 2-3 years ago whether a deterministic polytime algorithm was possible—in fact, this problem was being viewed as evidence that the class of polytime randomizedalgorithms with one-sided error is more powerful than the class of polytime deterministicalgorithms (the so called RP vs P question). With the discovery of a polytime algorithm forPrimality, however, the question still remains open and can go either way.• Lack of information. Randomization can be very helpful when the algorithm faces lack ofinformation. A classical example involves two parties, named A (for Alice) and B (for Bob),each in possession of an n bit number (say x and y resp.) that the other does not know,and each can exchange information with the other through an expensive communicationchannel. The goal is to find out whether they have the same number while incurring minimalcommunication cost. Note that the measure of efficiency here is the number of bits exchanged,and not the running time. It can be shown that a deterministic protocol has to exchange nbits in order to achieve guaranteed correctness. On the other hand, the following randomizedprotocol, based on the idea of fingerprinting, works correctly with almost certainty: A picks aprime p in the range [2n, 4n] at random, computes x mod p, and sends both x and p to B, towhich B responds with 1 or 0 indicating whether there was a match. With only O(log n) bitsexchanged, the probability of error in this protocol–i.e., Pr[x 6= y and x mod p = y mod p]–can be shown to be at most 1/n. By repeating the protocol, we can reduce the probabilityof an error to less than that of an asteroid colliding with either of A or B’s residences, whichshould be a practically sufficient threshold.Likewise, randomization is very helpful in the design of “online” algorithms that learn theirinput over time, or in the design of “oblivious” algorithms that output a single solution thatis good for all inputs. For example, suppose that we have n students and m << n advisors.We want to assign each student to an advisor, so that for any subset of the students thatdecide to consult their advisor on a given day, the number of students per advisor is moreor less even. Note that the subset need not be a uniformly random subset. This is a loadbalancing problem. One simple way to solve this problem is to assign a random advisor to2every student. We


View Full Document

UW-Madison COMPSCI 787 - Lecture 6 Randomized Algorithms

Download Lecture 6 Randomized Algorithms
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 6 Randomized Algorithms and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 6 Randomized Algorithms 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?