Let SHAM be the problem of finding a Hamiltonian cycle in a graph with divisible by and DHAM be the problem of determining if a Hamiltonian cycle exists in such graphs. Which one of the following is true?
View worked solution
Answer: A
To determine the complexity of and , we can relate them to the standard Hamiltonian Cycle (HC) problem, which is known to be NP-complete.
1. Analyzing (Decision Version)
We can show that the standard Hamiltonian Cycle problem reduces to in polynomial time ():
- Given an arbitrary graph , we construct a new graph by replacing each vertex with a path of vertices: .
- For every edge , we add edges in connecting the endpoints of their respective paths (e.g., and ).
- The number of vertices in is , which is guaranteed to be divisible by .
- Any Hamiltonian cycle in must traverse the vertices of each gadget consecutively. Thus, contains a Hamiltonian cycle if and only if contains a Hamiltonian cycle.
Since this reduction is polynomial-time, and the general Hamiltonian Cycle problem is NP-complete, the restricted decision problem is NP-hard.
2. Analyzing (Search Version)
The search version of a problem is always at least as hard as its decision version. If we had a polynomial-time algorithm to find a Hamiltonian cycle (), we could use it to decide if one exists () in polynomial time.
Since is NP-hard, the search problem must also be NP-hard.
Therefore, both and are NP-hard.
Free practice · Your answers on this page are not saved.
