# Homework Assignment #3

#### Due by fax to 413-545-1249, attention "Prof. Barrington", by 4:00 pm EST Thursday 20 April 2006

There are six questions for 100 total points. All are based on lectures 12-15, and thus on Chapter 6 of the Adler notes.

Students are responsible for understanding and following the academic honesty policies indicated on the course main page.

• Problem 3.1 (20): (From Kleinberg-Tardos 13.9) Suppose you are driving down a one-way street that you know to contain exactly n bars. The bars are rank-ordered by quality, without ties, but you may test the quality only by visiting a bar and once you leave you may not go back. Your goal is to maximize the probability of finding the best bar, under the assumption that each ordering is equally likely. (So, for example, if you stopped at the first one your probability would be 1/n, since the first is as likely to be the best as any other.) Describe a strategy that has probability at least 1/4 for all even n, and prove that the probability is at least this great.

• Problem 3.2 (20): (From Kleinberg-Tardos 13.12) Suppose we use the following Karger-like algorithm to try to find the minimal s-t cut in a given weighted graph. As in Karger, we choose a random edge to contract at each turn, but if an edge from s to t is ever created we delete it and continue. So we finish with two super-nodes, one containing s and the other t, and no edges -- this gives us our cut. Prove that the probability of finding the minimum s-t cut in this way may be exponentially small. (That is, give a family of examples, one for each n, such that the probability of success goes down exponentially with n.)

• Problem 3.3 (10): (From Motwani-Raghavan 14.10) Recall that a Carmichael number is a composite number that satisfies an-1 ≡ 1 (mod n) for every a that is relatively prime to n. Prove that a Carmichael number must be square-free, that is, that if n is a Carmichael number there does not exist a prime p such that p2 divides n.

• Problem 3.4 (20): (From Motwani-Raghavan 14.13) Suppose we have a deterministic algorithm S that has the following property -- if n is prime and x is a square modulo n, S(n,x) will be one of x's square roots modulo n (so we are guaranteed that S(n,x)2 ≡ x (mod n)). If x has no square root or if n is not prime, S(n,x) will give us an answer but we may make no assumptions about what it is.

Describe a randomized primality test for n using S. If n is prime, the test should always output "prime", and if n is composite it should return "composite" with probability at least 1/2.

• Problem 3.5 (20): Suppose we take a random walk on a complete directed graph of n vertices, so that on each step we choose our next vertex to visit uniformly and thus visit each node with probability 1/n. (A complete directed graph has loops, and we take a loop with probability 1/n on each step.) Explain how the Coupon Collector's Problem solution implies that with probability at least 1-1/n, we will visit all nodes within 4n ln n steps. Find a constant c such that you can prove that within c n2 ln n steps, the random walk will have used all n2 edges of the graph.

• Problem 3.6 (10): (From Motwani-Raghavan 3.2) Suppose we have n locations in a hash table and we place m items in the table by choosing a location uniformly and independently for each item. How large must m be, as a function of n, so that the probability of a collision is at least 1/2?