homework solution

Document Sample
homework solution Powered By Docstoc
					Homework #1 in Design and Analysis of Algorithms
Question 1
A clique in a graph G = (V, E) is a subset C ⊆ V such that there is an edge between every pair of
vertices in C. A maximum clique is a clique with a maximum number of vertices.
(a) Show that the minimum vertex-cover problem and the maximum clique problem have the same
    complexity up to polynomial factors. That is: If you had an algorithm for solving the minimum
    vertex-cover problem in time T (n) (where n = |V |) then you would have an algorithm for solving
    the maximum clique problem in time T (n) + poly(n) (where poly(n) denotes some polynomial
    in n), and that the reverse statement also holds.
    Hint: think of the complementary graph (that is, in which non-edges are replaced by edges and
    edges by non-edges).
(b) Given that we have an approximation algorithm for the minimum vertex-cover with approxima-
    tion factor 2, does this imply, given the above item, that we have approximation algorithm for
    the maximum clique problem?

Question 2
Let G = (V, E) be a graph such that every vertex in the graph has degree at most d. Show that the
minimum vertex cover of G is of size at least 2d−1 (where m = |E|). (Think of the approximation
algorithm described in class and the relation between the number of edges that are included in the
maximal matching that the algorithm determines compared to the number of edges that not included
in the matching.)

Question 3
Let G = (V, E) be a connected graph (that is, there is a path between every pair of vertices), where
n = |V | ≥ 2. Recall that a Depth First Search (DFS ) in a graph is a procedure for visiting all vertices
in the graph (assuming it is connected), in the following manner. Starting from an arbitrary initial
vertex v0 , at each step, if the current vertex has some neighbors that have not yet been visited, then
we continue to one of those neighbors. Otherwise, we return back to the previous vertex. The search
ends when we have returned to v0 for the last time (and can’t continue since all its neighbors have
already been visited). The DFS procedure defines a tree over all graph vertices: The root of the tree
is v0 , and the parent of every other vertex is the vertex from which it was first reached.
    Given a connected graph G = (V, E), suppose we run DFS, obtain the resulting DFS tree T , and
let C ⊂ V be all internal vertices in T (that is, vertices that are not leaves of T ).
(a) Prove that C is a vertex cover of G. (All you need to know about DFS is what is written above.)
(b) Prove that the size of C is at most twice the size of a minimum vertex cover of G. Hint: show
    that there exists a matching1 T (and hence in G) that consists of at least |C|/2 edges. Prove
    that such a matching exists by induction on the number of internal vertices |C|.

Question 4
Let F = {S1 , . . . , Sm } be a family of sets such that Si ⊆ {1, . . . , n} for every 1 ≤ i ≤ m. We shall say
that H ⊂ {1, . . . , n} is a hitting set with respect to F if for every set Si ∈ F there exists an element
   Recall that a matching in a graph G = (V, E) is a subset of edges M ⊆ E such that no two edges in M have a
common end-point.

j ∈ H such that j ∈ Si . In other words, for every 1 ≤ i ≤ m we have that Si ∩ H = ∅.
     The Minimum Hitting Set problem is defined as follows: Given a family of sets F = {S1 , . . . , Sm }
the goal is to find a hitting set with respect to F with minimum size. This problem is NP-hard.
     Suppose the input is restricted in the following manner: For some fixed integer k, we have that
|Si | ≤ k for every 1 ≤ i ≤ m. Describe and analyze an algorithm for finding a hitting set with respect
to F such that H is at most k times larger than the minimum hitting set.


Shared By:
Description: hi it is best describe online class.