Computer ScienceAlgorithms & Data StructuresAdvanced

NP-Completeness

Also known as:NPCNon-deterministic Polynomial-time Complete

NP-completeness is a classification in computational complexity theory denoting decision problems that are both in NP (solutions verifiable in polynomial time) and NP-hard (at least as hard as every problem in NP under polynomial-time reductions). A problem is NP-complete if every NP problem can be transformed into it in polynomial time, implying that finding a polynomial-time algorithm for any one NP-complete problem would solve all NP problems. Classic NP-complete problems include Boolean satisfiability (SAT), the Travelling Salesman Problem (decision version), and the Subset Sum problem.

Classic NP-Complete Problems and Their Real-World Applications

ProblemInputQuestionReal-World ApplicationBest Known Complexity
Boolean SATPropositional formulaIs there a satisfying assignment?Circuit design, software verificationO(2^n) worst case
Travelling Salesman (decision)Cities, distances, bound kTour of cost ≤ k?Logistics, chip manufacturingO(n! ) exact
Knapsack (0/1)Items with weights/values, capacityValue ≥ k within capacity?Resource allocation, budgetingO(2^n) exact
Graph Colouring (k≥3)Graph G, integer kColourable with k colours?Register allocation, schedulingO(k^n) exact
Subset SumSet of integers, target TSubset summing to T?Cryptography, financial planningO(2^n) exact
Hamiltonian PathGraph GPath visiting all vertices once?DNA sequencing, network designO(n! ) exact

Interactive Tools

Brilliant — NP-Completeness

Open Tool

Khan Academy — Algorithms

Open Tool

WolframAlpha — Computational Theory

Open Tool
Euler diagram showing the relationships between P, NP, NP-complete, and NP-hard complexity classes

Wikimedia Commons, CC BY-SA

Related Terms

The term "NP-complete" was coined by Stephen Cook in his landmark 1971 paper "The Complexity of Theorem Proving Procedures," where he proved SAT is NP-complete. "NP" stands for "Nondeterministic Polynomial time," referring to nondeterministic Turing machines. Richard Karp extended the framework in 1972 by demonstrating 21 additional NP-complete problems.

complexity-theorynp-completedecision-problemscomputational-complexityalgorithms