examf99.ps

Upload: mrunal-ruikar

Post on 10-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Examf99.Ps

    1/2

    Columbia UniversityW4231 : Analysis of Algorithms I Fall99Professor Luca Trevisan

    Comprehensive Exam

    This is a closed book exam. You cannot use book, notebooks, or a calculator. You canuse one double-sided sheet of notes.

    Read the questions carefully, and write your solution clearly and concisely. Partial creditwill be given for incomplete solutions.

    GOOD LUCK!

    Problem 1. Master Theorem

    Here is a table of logarithms. In the row i and column j you find the value of logij.

    1 2 3 4

    2 log2 1 = 0 log2 2 = 1 log2 3 = 1.5849 log2 4 = 2

    3 log3 1 = 0 log3 2 = .6309 log3 3 = 1 log3 4 = 1.2618

    4 log4 1 = 0 log4 2 = .5 log4 3 = .7924 log4 4 = 15 log5 1 = 0 log5 2 = .4306 log5 3 = .6826 log5 4 = .8613

    Solve the following recursions (c is always a constant). Give only the final results.

    (a) T(n) = 4T(n/4) + cn.

    (b) T(n) = 5T(n/3) + cn2.

    Problem 2. Graph Terminology

    (a) For a directed graph G = (V, E), what is the definition of G being stronglyconnected? What is the definition of being acyclic?

    [Note: In your answer it is not necessary to define the terms directed path anddirected cycle]

    (b) If a directed graph with two or more nodes is strongly connected, can it beacyclic? Draw an example of a strongly connected acyclic graph with more thantwo vertices or explain why such graphs do not exist.

    Problem 3. Design of Algorithms

    Given a (not necessarily sorted) sequence a[1], . . . , a[n] of integers, we want to determinewhether there are two indices i and j such that a[i] = 2 a[j]. Describe a O(n log n)algorithm for this problem.

    1

  • 8/8/2019 Examf99.Ps

    2/2

    Problem 4. Cuts and Flows

    Consider the following network and associated flow. Is the flow optimum? If so give a cutwhose capacity is the same as the cost of the flow. If it is not, give an augmenting path.(An augmenting path can be specified as the sequence of vertices that form the path, or itcan be drawn on the picture below. A cut can be specified by listing the vertices that areon the same side of s, or by drawing a separating line on the picture below.)

    s t

    a

    b c

    d5(2)

    2(1)

    4(2)

    2(2)

    1(1)

    10(3)

    2(2)

    1(1)

    Problem 5. NP-completeness

    In the Clique problem, an input is a pair (G, k) where G is an undirected graph and k is an

    integer. The correct answer is YES if G contains a clique of size k, and NO if all cliques inG have size < k. This problem is NP-complete.

    Consider the restriction of the Clique problem to inputs (G, k) where k is odd. Prove thatthis problem is NP-complete.

    [Hint: reduce from the standard Clique problem]

    Problem 6. Modular arithmetic

    (a) For an integer n 3, what is the definition of Zn and what is the definition of

    (n)?. What is (35)?(b) Suppose I am given n, where n = pq is the product of two odd distinct primes,

    and I am also given a positive integer a {1, . . . , n 1} such that a Zn, but Iam not given p and q. Can I compute the factorization of n in time polynomialin the number of digits of n?

    2