QB4 - Greedy & NPC - Solution

QB4 - Greedy & NPC - Solution - COMP 271 Design and...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COMP 271 Design and Analysis of Algorithms 2004 Fall Semester Solutions to Question Bank Number 4 (Selected Problems) NP-completeness 1. (i) True. (ii) False. (iii) True. (iv) False. (v) True. 2. (i) False. Since P ⊆ NP , certainly some problems in NP can be solved in poly- nomial time. (ii) True. In order to be in NP, there must be a certificate which allows us to test membership in polynomial time. Thus a certificate is of polynomial length, and so we can enumerate all the certificates in exponential time and test each one using the verification procedure. (iii) Unknown. This is because it is still open whether P = NP . (iv) Unknown. If P = NP , this is correct. Otherwise it could be false. 3. Suppose that G is a graph that has a feedback vertex set of size k . The certificate is the set V ′ of vertices that are in the feedback vertex set. To determine whether V ′ is indeed a feedback vertex set, we need to test whether every cycle in G passes through at least one of these vertices. Note that there are exponentially many cycles in a graph, so testing each cycle would not run in polynomial time. Instead we delete all the vertices of V ′ from G , along with any incident edges. Let G ′ denote the resulting graph. Then we test whether G ′ has a cycle, by running DFS and checking whether the resulting tree has at least one backedge. If so, V ′ is not a feedback edge set (since the cycle in G ′ does not pass through any vertex of V ′ ) and otherwise it is. 1 4. Subgraph-Isomorphism (SI) ∈ NP First we show that subgraph-isomorphism is in NP. The certificate consists of the mapping of the vertices of G 1 to the vertices of G 2 , such that if there is an edge between any two vertices in G 1 then there is also an edge between the corresponding vertices in G 2 . This mapping can be specified usign a table T such that vertex i of G 1 maps to vertex T ( i ) of G 2 . Given such a table T , we can verify by checking for each edge { i,j } of G 1 , whether f ( i ) and f ( j ) are connected by an edge in G 2 ....
View Full Document

This note was uploaded on 10/18/2009 for the course COMP 271 taught by Professor Arya during the Spring '07 term at HKUST.

Page1 / 4

QB4 - Greedy & NPC - Solution - COMP 271 Design and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online