Homework 6

CMU 15-251
Spring 2015
Homework 6 — Writing session on Wednesday March 4
For this homework, you may assume that the following problems are NP-complete:
CIRCUIT-SAT: Given a Boolean circuit with AND, OR, and NOT gates, is there an assignment to the input variables that makes the circuit output True?
SAT: Given a propositional formula, is there an assignment to the variables that makes the
formula True.
3SAT: Given a propositional formula in conjunctive normal form such that each clause contains exactly 3 literals, is there an assignment to the variables that makes the formula True?
CLIQUE: Given an undirected graph and a number k, are there k vertices in the graph such
that there is an edge between any pair of them?
VERTEX-COVER: Given an undirected graph and a number k, are there k vertices that
touch every edge in the graph?
HAMILTONIAN-CYCLE: Given an undirected graph, is there a cycle that visits every vertex?
3COL: Given an undirected graph, can we color the vertices with 3 colors so that no two
adjacent vertices share the same color?
SUBSET-SUM: Given a set of integers, and a target integer t, is there a subset of the integers
that sum to t?
1. Closure (SOLO). Let L1 , L2 ∈ NP. Prove or disprove:
(a) L1 ∩ L2 must be in NP.
(b) L1 ∪ L2 must be in NP.
2. Composite (SOLO). Let COMPOSITE be the following decision problem: Given as input
a positive integer N written in binary, is N composite?1 Prove that COMPOSITE ∈ NP.
3. Path problems (SOLO). Show that the following problems are NP-complete:
(a) Given a graph G, is there a path that visits every vertex of the graph exactly once?
(b) Given a graph G and an integer k, is there a path of length k?
(c) Given a graph G and an integer k, is there a spanning tree in G that contains at most
k leaves?
Composite means that N is not a prime number and is not 1.
4. Hospital hardness (GROUP). The president of a large country can afford to build hospitals in up to k different towns. The goal is that everybody has a hospital in their town, or at
least in a neighboring town. Show that determining if this is possible is NP-complete. More
formally, let
HOSP = {hG = (V, E), ki : ∃H ⊆ V with |H| ≤ k such that ∀v ∈ V,
either v ∈ H or w ∈ H for some {v, w} ∈ E}.
Show that HOSP is NP-complete. (Hint: we suggest reduction from VERTEX-COVER.)
5. Hospital approximation (GROUP). Perhaps the president determines that the goal was
just not feasible. Still, the hope is that everyone will be somewhat close to a hospital.
Suppose we have a connected graph G = (V, E) and a subset H ⊆ V . For any vertex v ∈ H,
we write dist(v, H) for the length of the shortest path in G from v to any vertex in H. We
also define the radius of H to be
radius(H) = max{dist(v, H) : v ∈ V }.
This is like “the farthest anyone has to travel to get to a hospital”. It is a fact (you don’t
have to prove it) that, given G and k, it is NP-hard to find the size-k set H ⊆ V with smallest
radius. We want you to analyze a polynomial-time algorithm for finding a size-k set H which
nevertheless has pretty good radius. Consider the below algorithm, A:
A: input is a connected graph G = (V, E) and a positive integer k.
Let H = {v1 }, where v1 ∈ V is an any arbitrary vertex.
for i = 2, 3, . . . , k
Determine the vertex vi ∈ V for which dist(vi , H) is largest.2
Add vi into H.
Output H.
Show that this algorithm is guaranteed to output a set H whose radius is at most two times
the best possible radius. In other words, show that for all inputs G, k, if we define H ∗ to be
the size-k subset of V with smallest radius, and we define H to be the size-k subset actually
output by algorithm A, then always
radius(H) ≤ 2 · radius(H ∗ ).
(Hint: Of course, the algorithm A doesn’t “know” what H ∗ is, but you can still reason about
what H ∗ is when analyzing algorithm A. Think about the “coverage zones” defined by H ∗ :
i.e., for each hospital in H ∗ , the set of towns that are closest to it. How far apart can two
towns in the same coverage zone be? Will A always pick exactly one town per coverage zone?)
(OPEN). Define the 31 SAT problem as follows: Given as input is a set of “triples”
over propositional variables x1 , . . . , xn . Here a “triple” is defined to be a set of three variables
(not necessarily distinct.) The task is to decide if there is a truth assignment to x1 , . . . , xn so
that in each triple, exactly one variable is made True. Show that 13 SAT is NP-complete.
Break ties arbitrarily. Note that we can do this step in polynomial time: For each vertex u ∈ V , we can do
BFS from u to find the distance to closest vertex in H. Then we choose vi to be the u for which the distance is the
7. Wigderson (OPEN). Read the following article and write a 1-page critique of it: