NP-Completeness Explained — Decision Problems, Polynomial-Time Reductions, and Computational Hardness | Chapter 34 in Introduction to Algorithms
NP-Completeness Explained — Decision Problems, Polynomial-Time Reductions, and Computational Hardness | Chapter 34 in Introduction to Algorithms
Chapter 34 of Introduction to Algorithms by Cormen et al. introduces the critical concepts of NP-completeness and computational intractability, focusing on classes like P, NP, and co-NP, and how polynomial-time reductions help define problem difficulty. This post breaks down the central ideas behind decision problems, verification, and problem reductions that are essential for understanding theoretical computer science and real-world algorithmic challenges.
📺 Watch the full breakdown on YouTube:

What Is NP-Completeness?
NP-completeness is a concept in computational complexity theory that identifies the hardest problems in the class NP—problems for which solutions can be verified in polynomial time. If any NP-complete problem is solved in polynomial time, then all problems in NP can also be solved in polynomial time, implying P = NP—a question that remains one of the greatest open problems in computer science.
The Class P and Polynomial-Time Solvability
- P includes problems that can be solved by a deterministic algorithm in polynomial time (e.g., O(nk)).
- Problems in P are considered tractable or efficiently solvable.
- All inputs must be encoded as binary strings for formal analysis.
The Class NP and Verification Algorithms
- NP includes problems where a "yes" answer can be verified in polynomial time, given a certificate.
- A verification algorithm takes input and a certificate and accepts valid inputs efficiently.
- Examples: Hamiltonian Cycle, 3-CNF-SAT.
Importantly, P ⊆ NP, but whether P = NP remains unresolved.
co-NP and Complement Classes
- co-NP consists of problems whose complements are in NP.
- P is closed under complementation, so P ⊆ NP ∩ co-NP.
- The open question of NP vs. co-NP mirrors that of P vs. NP.
Understanding NP-Complete Problems
A problem L is NP-complete if:
- L ∈ NP
- Every other problem in NP can be polynomially reduced to L
Polynomial-time reductions transform instances of one problem into another while preserving the yes/no answer. This concept is the bedrock for proving computational hardness.
The First NP-Complete Problem: CIRCUIT-SAT
CIRCUIT-SAT asks whether a given Boolean circuit has a satisfying input. It was the first problem proven to be NP-complete and serves as the base for many reductions. Stephen Cook’s proof in 1971 is the foundation of the Cook-Levin theorem.
Proving NP-Completeness
To show a problem is NP-complete, follow this standard method:
- Prove the problem is in NP.
- Reduce a known NP-complete problem (like 3-CNF-SAT) to it in polynomial time.
The reduction must preserve the “yes”/“no” decision logic of the original problem.
Classic NP-Complete Problems
- CLIQUE – Is there a k-sized clique in graph G? Reduced from 3-CNF-SAT.
- VERTEX-COVER – Is there a vertex cover of size ≤ k? Reduced from CLIQUE via graph complement.
- HAM-CYCLE – Is there a Hamiltonian cycle in a graph? Reduced from VERTEX-COVER using gadget structures.
- TSP (Decision version) – Is there a tour of cost ≤ k? Reduced from HAM-CYCLE using edge costs.
- SUBSET-SUM – Is there a subset that sums to target t? Reduced from 3-CNF-SAT.
Techniques for Reductions and Gadget Design
- Use gadgets to simulate logic or constraints.
- Exploit graph complements, edge weights, and specific structures.
- Ensure reductions are always from known NP-complete problems.
Glossary of Key Terms
- NP-Complete – A problem in NP that is as hard as any NP problem.
- NP-Hard – At least as hard as NP problems, but not necessarily in NP.
- Certificate – Verifiable proof that a solution is correct.
- Reduction – A transformation that shows one problem’s complexity by comparing it to another.
- Gadget – A constructed component used in reductions to simulate logic.
Conclusion
Chapter 34 provides a vital foundation for understanding why some problems are computationally hard and how to classify them rigorously. Whether you're studying for an advanced algorithms course or prepping for a coding interview, mastering NP-completeness is crucial. The chapter not only highlights classic problems like SAT and TSP but also teaches you how to prove hardness via reductions.
To see these examples animated and explained visually, watch the full video breakdown on YouTube.
Explore more chapter summaries from Introduction to Algorithms and subscribe to stay on top of your studies.
If you found this breakdown helpful, be sure to subscribe to Last Minute Lecture for more chapter-by-chapter textbook summaries and academic study guides.
Comments
Post a Comment