Question
Assuming P ≠ NP, which decision problem is NOT NP-complete?
A.Boolean satisfiability (SAT)
B.Hamiltonian cycle
C.Subset sum
D.Checking whether a given array is sorted
Correct Answer: D. Checking whether a given array is sorted
Detailed textbook explanation
Step-by-step solution
The question asks which problem is not NP-complete, assuming P ≠ NP.
Recall the classes:
- P: problems solvable in polynomial time.
- NP: problems whose solutions can be verified in polynomial time.
- NP-complete: problems in NP to which every NP problem reduces in polynomial time; they are the 'hardest' problems in NP.
Checking whether an array is sorted requires a single left-to-right scan comparing adjacent elements, which takes O(n) time. Hence it lies in P.
If P ≠ NP, then no problem in P can be NP-complete (an NP-complete problem in P would force P = NP). So 'checking whether a given array is sorted' is not NP-complete.
By contrast, SAT (Cook–Levin theorem), Hamiltonian cycle, and subset sum are all classical NP-complete problems.
Key takeaway
A problem solvable in polynomial time cannot be NP-complete unless P = NP.
Common mistake
Assuming any 'hard-sounding' problem is NP-complete; a simple linear scan is clearly polynomial.