{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

chapter8

# chapter8 - Chapter 8 Solutions 2 8.1 Assume that T SP(G b...

This preview shows pages 1–3. Sign up to view the full content.

Chapter 8 - Solutions

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 8.1 Assume that TSP ( G, b ) returns false if no tour of length b or less exists in G . Then the following functions solve TSP - OPT using TSP . TSP-OPT( G ) S = 0 for all u V , v V : S = S + dist ( u, v ) return BINARY-SEARCH-TOUR( G, 0 , S ) BINARY-SEARCH-TOUR( G, l, u ) b = ( l + u ) / 2 if TSP( G, b ) = false return BINARY-SEARCH-TOUR( G, l, b ) else return BINARY-SEARCH-TOUR( G, b, u ) Basically, the algorithm just does a binary search over all possible lengths of the optimal tour, going from 0 to the sum of all distances. Note that binary search is necessary here and we can’t just increment the value of b by 1 each time since the sum of all distances is exponential in the size of the input. 8.2 We impose an arbitrary ordering on the edges and remove the edges one by one. If the graph obtained by removing an edge from the current graph still has a Rudrata path, we remove e permanently and update the current graph. If the new graph does not have a Rudrata path, we add e back. Hence, we maintain the invariant that the graph we have always has a Rudrata path (if the given graph did). Since it is possible to remove all edges except a single Rudrata path, we will be left a Rudrata path in the end. 8.3 It’s a generalization of SAT. Given a SAT formula ϕ with n variables, ( ϕ, n ) is an instance of STINGY SAT which has a solution if and only if the original SAT formula has a satisfying assignment. 8.4 (a) Given a clique in the graph, it is easy to verify in polynomial time that there is an edge between every pair of vertices. Hence a solution to CLIQUE-3 can be checked in polynomial time. (b) The reduction is in the wrong direction. We must reduce CLIQUE to CLIQUE-3, if we intend to show that CLIQUE-3 is at least as hard as CLIQUE. (c) The statement “a subset C V is a vertex cover in G is and only if the complimentary set V - C is a clique in G ” used in the reduction is false. C is a vertex cover if and only if V - C is an independent set in G . (d) The largest clique in the graph can be of size at most 4, since every vertex in a clique of size k must have degree at least k - 1. Thus, there is no solution for k > 4, and for k 4 we can check every k -tuple of vertices, which takes O ( | V | k ) = O ( | V | 4 ) time. 8.5 3D-MATCHING to SAT We have a variable x bgp for each given triple ( b, g, p ). We interpret x bgp = true as choosing the triple ( b, g, p ). Suppose for boy b , ( b, g 1 , p 1 ) , . . . , ( b, g k , p k ) are triples involving him. Then we add the clause ( x bg 1 p 1 . . . x bg k p k ) so that at least one of the triples is chosen. Similarly for the triples involving each girl or pet. Also, for each pair of triples involving a common boy, girl or pet, say ( b 1 , g, p 1 ) and ( b 2 , g, p 2 ), we add a clause of the form (¯ x b 1 gp 1 ¯ x b 1 gp 1 ) so that at most one of the triples is chosen. The total number of triples, and hence the number of variables, is at most n 3 . The first type of clauses involve at most n 2 variables and we add 3 n such clauses, one for each boy, girl or pet. The second type of clauses involve triples sharing one common element. There are 3 n ways to choose the common
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}