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

The Hamiltonian cycle problem (HAM) is a classic NP-complete problem. Both the decision version (DHAM': does a Hamiltonian cycle exist?) and the search version (SHAM: find a Hamiltonian cycle) are NP-hard. For NP-complete problems, the decision and search versions are typically equivalent in complexity - if you can decide existence, you can usually construct the solution through binary search or other methods. Therefore, both DHAM' and SHAM are NP-hard.