Notes:
- For this class is is generally not necessary to validate input in your pseudocode: if a problem says the input will be in a certain form then write your pseudocode under the assumption that the input is in that form.
- "Find/devise/give an efficient algorithm" means "find an algorithm that is as efficient as possible, and you have to figure out for yourself whether your solution can be improved."
Problem 1: Show that 3−SAT≤PVERTEX_COVER by showing how to, given a 3-CNF formula ϕ, construct a graph G and pick an integer k so that ϕ has a satisfying assignment if and only if G has a vertex cover of size at most k. (For your own benefit, prove that your G and k have that property.)
Problem 2: HAMILTONIAN-PATH (HP: the problem of, given an undirected graph G, determining whether G has a Hamiltonian path) is NP-complete. But perhaps the problem becomes easier if we give ourselves a little wiggle room. Consider APPROX-HP, which is the problem of, given an undirected, connected graph G, determining if G has a path that visits n−1 vertices exactly once and the other vertex at least once, but traverses no edge more than once. Prove that this modified problem is not in fact any easier: APPROX-HP is NP-complete (here we do want the proof that whatever construction you come up with does in fact work).
Problem 3:
FIND-HAMILTONIAN-PATH (FHP) is the problem of,
given an undirected graph G,
returning a Hamiltonian path in G, or nil
if no such path
exists. Prove that FHP and HP are in some sense equivalently difficult:
there is a polynomial time algorithm for FHP if and only if there is a
polynomial time algorithm for HP.
Prove this by showing a) that HP≤PFHP;
b) FHP≤PHP by writing a polynomial-time algorithm for FHP that uses
a solution to HP as a subroutine (counting a use of that subroutine as
1 step); and c) that your algorithm for (b) is correct by writing the
invariant for it.