The.Algorithm.Design.Manual.Springer-Verlag.1998
The.Algorithm.Design.Manual.Springer-Verlag.1998 The.Algorithm.Design.Manual.Springer-Verlag.1998
Exercises Next: Implementation Challenges Up: Intractable Problems and Approximations Previous: The Euclidean Traveling Salesman Exercises 1. Prove that the vertex cover problem (does there exist a subset S of k vertices in a graph G such that every edge in G is incident upon at least one vertex in S?) remains NP-complete even when all the vertices in the graph are restricted to have even degree. 2. An instance of the set cover problem consists of a set X of n elements, a family F of subsets of X, and an integer k. The question is, do there exist k subsets from F whose union is X? For example, if and , there does not exist a solution for k=2 but there does for k=3 (for example, ). Prove that set cover is NP-complete with a reduction from vertex cover. 3. The baseball card collector problem is as follows. Given packets , each of which contains a subset of that year's baseball cards, is it possible to collect all the year's cards by buying packets? For example, if the players are and the packets are there does not exist a solution for k=2 but there does for k=3, such as Prove that the baseball card collector problem is NP-hard using a reduction from vertex cover. 4. (*) An Eulerian cycle is a tour that visits every edge in a graph exactly once. An Eulerian subgraph is a subset of the edges and vertices of a graph that has an Eulerian cycle. Prove that the problem of finding the number of edges in the largest Eulerian subgraph of a graph is NP-hard. (Hint: the Hamiltonian circuit problem is NP-hard even if each vertex in the graph is incident upon exactly three edges.) 5. The low degree spanning tree problem is as follows. Given a graph G and an integer k, does G contain a spanning tree such that all vertices in the tree have degree at most k (obviously, only tree edges count towards the degree)? For example, in the following graph, there is no spanning tree such that all vertices have degree less than three. file:///E|/BOOK/BOOK3/NODE122.HTM (1 of 3) [19/1/2003 1:30:00]
Exercises 1. Prove that the low degree spanning tree problem is NP-hard with a reduction from Hamiltonian path. 2. Now consider the high degree spanning tree problem, which is as follows. Given a graph G and an integer k, does G contain a spanning tree whose highest degree vertex is at least k? In the previous example, there exists a spanning tree of highest degree 8. Give an efficient algorithm to solve the high degree spanning tree problem, and an analysis of its time complexity. 6. (*) The problem of testing whether a graph G contains a Hamiltonian path is NP-hard, where a Hamiltonian path P is a path that visits each vertex exactly once. There does not have to be an edge in G from the ending vertex to the starting vertex of P, unlike in the Hamiltonian cycle problem. Given a directed acyclic graph G (a DAG), give an O(n+m)-time algorithm to test whether or not it contains a Hamiltonian path. (Hint: think about topological sorting and DFS.) 7. (**) The 2-SAT problem is, given a Boolean formula in 2-conjunctive normal form (CNF), decide whether the formula is satisfiable. 2-SAT is like 3-SAT, except that each clause can have only two literals. For example, the following formula is in 2-CNF: Give a polynomial-time algorithm to solve 2-SAT. 8. (*) It is an open question whether the decision problem ``Is integer n a composite number, in other words, not prime?" can be computed in time polynomial in the size of the input. Why doesn't the following algorithm suffice to prove it is in P, since it runs in O(n) time? PrimalityTesting(n) composite := for i := 2 to n-1 do file:///E|/BOOK/BOOK3/NODE122.HTM (2 of 3) [19/1/2003 1:30:00] if then composite :=
- Page 291 and 292: Neural Networks Next: Genetic Algor
- Page 293 and 294: Genetic Algorithms Next: War Story:
- Page 295 and 296: War Story: Annealing Arrays Next: P
- Page 297 and 298: War Story: Annealing Arrays optimal
- Page 299 and 300: Parallel Algorithms Next: War Story
- Page 301 and 302: War Story: Going Nowhere Fast Next:
- Page 303 and 304: Exercises Next: Implementation Chal
- Page 305 and 306: Problems and Reductions Next: Simpl
- Page 307 and 308: Simple Reductions Next: Hamiltonian
- Page 309 and 310: Hamiltonian Cycles Next: Independen
- Page 311 and 312: Independent Set and Vertex Cover pr
- Page 313 and 314: Clique and Independent Set These la
- Page 315 and 316: Satisfiability Mon Jun 2 23:33:50 E
- Page 317 and 318: The Theory of NP-Completeness Next:
- Page 319 and 320: 3-Satisfiability where for , , , an
- Page 321 and 322: Integer Programming Next: Vertex Co
- Page 323 and 324: Integer Programming possible IP ins
- Page 325 and 326: Vertex Cover reduction for the 3-SA
- Page 327 and 328: Other NP-Complete Problems hard. Th
- Page 329 and 330: The Art of Proving Hardness easiest
- Page 331 and 332: War Story: Hard Against the Clock N
- Page 333 and 334: War Story: Hard Against the Clock I
- Page 335 and 336: Approximation Algorithms Next: Appr
- Page 337 and 338: Approximating Vertex Cover Next: Th
- Page 339 and 340: The Euclidean Traveling Salesman Ne
- Page 341: The Euclidean Traveling Salesman Ne
- Page 345 and 346: Data Structures Next: Dictionaries
- Page 347 and 348: Dictionaries Next: Priority Queues
- Page 349 and 350: Dictionaries use a function that ma
- Page 351 and 352: Dictionaries Implementation-oriente
- Page 353 and 354: Priority Queues ● Besides access
- Page 355 and 356: Priority Queues Fibonacci heaps [FT
- Page 357 and 358: Suffix Trees and Arrays Figure: A t
- Page 359 and 360: Suffix Trees and Arrays [GBY91]. Se
- Page 361 and 362: Graph Data Structures algorithms).
- Page 363 and 364: Graph Data Structures including the
- Page 365 and 366: Set Data Structures Next: Kd-Trees
- Page 367 and 368: Set Data Structures parent pointers
- Page 369 and 370: Kd-Trees Next: Numerical Problems U
- Page 371 and 372: Kd-Trees about p. Say we are lookin
- Page 373 and 374: Numerical Problems Next: Solving Li
- Page 375 and 376: Numerical Problems Mon Jun 2 23:33:
- Page 377 and 378: Solving Linear Equations algorithm
- Page 379 and 380: Solving Linear Equations Matrix inv
- Page 381 and 382: Bandwidth Reduction images near eac
- Page 383 and 384: Matrix Multiplication Next: Determi
- Page 385 and 386: Matrix Multiplication The linear al
- Page 387 and 388: Determinants and Permanents Next: C
- Page 389 and 390: Determinants and Permanents exposit
- Page 391 and 392: Constrained and Unconstrained Optim
Exercises<br />
1. Prove that the low degree spanning tree problem is NP-hard with a reduction from Hamiltonian path.<br />
2. Now consider the high degree spanning tree problem, which is as follows. Given a graph G and an<br />
integer k, does G contain a spanning tree whose highest degree vertex is at least k? In the previous<br />
example, there exists a spanning tree of highest degree 8. Give an efficient algorithm to solve the high<br />
degree spanning tree problem, and an analysis of its time complexity.<br />
6. (*) <strong>The</strong> problem of testing whether a graph G contains a Hamiltonian path is NP-hard, where a Hamiltonian path<br />
P is a path that visits each vertex exactly once. <strong>The</strong>re does not have to be an edge in G from the ending vertex to<br />
the starting vertex of P, unlike in the Hamiltonian cycle problem.<br />
Given a directed acyclic graph G (a DAG), give an O(n+m)-time algorithm to test whether or not it contains a<br />
Hamiltonian path. (Hint: think about topological sorting and DFS.)<br />
7. (**) <strong>The</strong> 2-SAT problem is, given a Boolean formula in 2-conjunctive normal form (CNF), decide whether the<br />
formula is satisfiable. 2-SAT is like 3-SAT, except that each clause can have only two literals. For example, the<br />
following formula is in 2-CNF:<br />
Give a polynomial-time algorithm to solve 2-SAT.<br />
8. (*) It is an open question whether the decision problem ``Is integer n a composite number, in other words, not<br />
prime?" can be computed in time polynomial in the size of the input. Why doesn't the following algorithm<br />
suffice to prove it is in P, since it runs in O(n) time?<br />
PrimalityTesting(n)<br />
composite :=<br />
for i := 2 to n-1 do<br />
file:///E|/BOOK/BOOK3/NODE122.HTM (2 of 3) [19/1/2003 1:30:00]<br />
if then<br />
composite :=