Cook–Levin theorem (SAT is NP-complete) is the seed: it shows every NP problem reduces to SAT directly from the Turing-machine definition. After that, all other problems are proven hard by reducing from an already-proven NP-complete problem. The classic chain:
SAT≤p3-SAT≤pClique≤pVertex Cover≤pHamiltonian Cycle≤pTSP3-SAT≤pSubset Sum
Nondeterministic Polynomial — a certificate can be verified in polynomial time.
Define NP-complete.
A problem that is both in NP and NP-hard (every NP problem reduces to it in poly time).
To prove problem B is NP-hard, which direction is the reduction?
Reduce a known NP-complete problem A into B: A≤pB.
What does A≤pB guarantee?
x∈A⟺f(x)∈B with f poly-time; a fast solver for B gives one for A.
Which theorem first established an NP-complete problem?
Cook–Levin theorem (SAT is NP-complete).
Relation between Independent Set and Vertex Cover?
I independent of size k⟺V∖I is a vertex cover of size n−k.
Clique vs Independent Set link?
Clique in G⟺ Independent Set in complement graph Gˉ.
In 3-SAT→Clique, when is there an edge between two literal-vertices?
Different clauses AND not negations of each other; clique size k=m.
Why isn't Subset Sum's O(nt) DP a poly-time algorithm?
t has logt bits, so t can be exponential in input length → pseudo-polynomial.
In HamCycle→TSP, what edge weights and budget are used?
Weight 1 for real edges, 2 otherwise; budget B=∣V∣ (a tour is a cycle with ∣V∣ edges).
Why is the TSP budget ∣V∣ and not ∣V∣−1?
A TSP tour is a cycle returning to start, so it has ∣V∣ edges, not ∣V∣−1 like a path.
Is NP-complete the same as undecidable?
No — NP-complete problems are decidable (brute force terminates); just (likely) not poly-time.
Decision form of TSP?
Given weighted complete graph and budget B, is there a tour (cycle) of total cost ≤B?
Recall Feynman: explain to a 12-year-old
Imagine a huge group of puzzles — Sudoku, mazes, packing suitcases. They all look different, but there's a secret machine that can turn any one puzzle into any other. So they're really one giant puzzle in disguises. We don't know a quick trick to solve them, but if you finish one, we can check your answer super fast. And the wild part: if someone ever finds a fast trick for just one, the machine instantly gives a fast trick for all of them. These disguised twins are called NP-complete.
Dekho, NP-complete problems basically ek hi gang ke members hain jo alag-alag costume pehne hue hain. 3-SAT, Clique, Vertex Cover, Hamiltonian Cycle/Path, TSP, Subset Sum — yeh sab apparently bohot hard lagte hain (koi fast solution nahi pata), par inki ek khaas baat hai: agar koi tumhe answer de de, to tum usse polynomial time mein verify kar sakte ho. Isi ko NP kehte hain — "verify karna easy, dhoondhna hard". Aur NP-complete matlab yeh NP ke andar ke sabse hard problems hain. (Independent Set ek helper twin hai jo Clique aur Vertex Cover ko jodta hai.)
Asli jaadu hai reduction. Reduction ek fast translator hai: A≤pB ka matlab — agar B ka fast solver mil jaaye, to A bhi fast solve ho jaayega. Toh hardness prove karne ka rule yaad rakho: naye problem B ko hard dikhane ke liye, kisi already-known hard problem ko B ke andar feed karo. Direction ulta mat karna — yeh sabse common galti hai! Cook–Levin theorem ne sabse pehle SAT ko NP-complete prove kiya, aur baaki sab usi se chain banake prove hue.
Ek important trap: Subset Sum ka O(n⋅t) DP dekh ke lagta hai "are yeh to polynomial hai!" — par nahi. Target t ek number hai jiski length sirf logt bits hai, toh t input ke size mein exponential ho sakta hai. Isko pseudo-polynomial kehte hain. Aur ek aur dhyaan dene wali baat — TSP ka tour ek cycle hota hai (start pe wapas aata hai), isliye usme n edges hote hain, n−1 nahi. Isiliye HamCycle→TSP reduction mein budget B=n rakhte hain, n−1 nahi. Yeh poora khel P vs NP ke million-dollar question ke center mein hai, aur NP-complete ka matlab undecidable nahi — yeh solve to ho jaate hain brute force se, bas fast nahi.