Multiple choice

Let SHAM, be the problem of finding a Hamiltonian cycle in a graph G = (V, E) with V divisible by 3 and DHAM' be the problem of determining if a Hamiltonian cycle exists in such graphs. Which one of the following is true?

  1. Both DHAM, and SHAM, are NP-hard

  2. SHAM, is NP-hard, but DHAM, is not

  3. DHAM, is NP-hard, but SHAM, is not

  4. Neither DHAM, nor SHAM, is NP-hard

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

SHAM₃ (finding Hamiltonian cycle in graphs where |V| is divisible by 3) is at least as hard as DHAM₃ (deciding existence). Since finding a solution is always at least as hard as deciding existence (given a finding algorithm, we can decide existence), SHAM₃ is NP-hard if DHAM₃ is. DHAM₃ is a special case of the Hamiltonian cycle problem, which is NP-complete, so DHAM₃ is NP-hard. Therefore both are NP-hard.