4.6.26 · D5Theory of Computation

Question bank — NP-complete problems — 3-SAT, Vertex Cover, Clique, Hamiltonian Path, TSP, Subset Sum

1,708 words8 min readBack to topic

True or false — justify

True or false: If a problem is in NP, then it must be hard to solve.
False. NP just means a proposed answer is checkable in polynomial time. Every problem in P is also in NP (checking is at least as easy as re-solving), so "in NP" says nothing about being hard.
True or false: NP-complete problems have no known polynomial-time algorithm, and it is proven none exists.
False. No polynomial algorithm is known, but none is proven impossible either — that unresolved gap is exactly the P vs NP question.
True or false: If someone finds a polynomial algorithm for Vertex Cover, then TSP (decision) is also solvable in polynomial time.
True. Vertex Cover is NP-complete, so every NP problem — including TSP — reduces to it in poly time; a fast solver for one collapses the whole class into P.
True or false: To prove a new problem is NP-hard, you reduce into a known NP-complete problem (i.e. ).
False, and this is the classic direction error. You reduce the known-hard into (), feeding the monster to . Reducing into only shows is no harder than .
True or false: Subset Sum is in P because it has an dynamic-programming algorithm.
False. The target is written in bits, so can be exponential in the input length. The DP is pseudo-polynomial, not polynomial — see Dynamic Programming — Subset Sum / Knapsack.
True or false: An independent set in graph is the same set of vertices as a clique in the complement graph .
True. An independent set has no internal edges in ; flipping every edge (forming ) turns all those non-edges into edges, making the same vertices pairwise adjacent — a clique.
True or false: If is an independent set of size in a graph on vertices, then is a vertex cover of size .
True. Any edge with both endpoints in would violate independence, so every edge has at least one endpoint outside — exactly the vertex-cover condition. See Graph Theory — Cliques and Independent Sets.
True or false: The Cook–Levin theorem proves 3-SAT is NP-complete by reducing 3-SAT to some other problem.
False. Cook–Levin proves SAT is NP-complete directly from the Turing-machine definition — every NP problem reduces to SAT. 3-SAT's hardness then follows by reducing SAT into 3-SAT.
True or false: A verifier for an NP problem is allowed to say "yes" to a false certificate as long as it runs fast.
False. A valid verifier must accept some certificate exactly when the true answer is yes, and reject all certificates when the answer is no. Correctness, not just speed, defines NP.
True or false: Because all NP-complete problems inter-reduce, an approximation algorithm for one automatically gives a good approximation for all.
False. Reductions preserve yes/no answers, not the quality of near-solutions. Approximability differs wildly — see Approximation Algorithms; Vertex Cover has a 2-approximation while general TSP has no constant-factor one unless P = NP.

Spot the error

"3-SAT is NP-complete, so no 3-SAT instance can ever be solved quickly."
Wrong. NP-completeness is about worst-case scaling, not individual instances. Many specific formulas (e.g. small ones, or those in special structured classes) solve instantly; hardness lives in the family, not every member.
"I reduced 3-SAT to Clique in polynomial time, therefore Clique is easy."
Backwards conclusion. That reduction shows Clique is at least as hard as 3-SAT — it proves Clique is hard, not easy. A reduction transfers hardness forward along the arrow.
"In the 3-SAT-to-Clique gadget I put an edge between the two vertices and from different clauses."
Error. Vertices for a literal and its negation must have no edge — picking both would set true and false simultaneously. Blocking that edge is what enforces a consistent assignment.
"For Hamiltonian-Cycle-to-TSP I set the budget to because a path on vertices has edges."
Error. TSP asks for a cycle (tour), which returns to start and uses exactly edges, so the correct budget is . Using would reject every valid tour.
"Subset Sum's gadget uses base 2 so the numbers stay small."
Error. A base like 10 (comfortably larger than the max per-column sum) is chosen so digit columns never carry into each other. Base 2 would let column sums overflow and corrupt neighbouring variable/clause bits.
"A vertex cover and an independent set can overlap, since a vertex can be in both."
Error. They are exact complements: . A vertex is in the cover or the independent set, never both — that partition is the whole duality.
"Every problem in NP-hard is also in NP."
Error. NP-hard means "at least as hard as everything in NP," which includes problems harder than NP — even undecidable ones like the Halting Problem. Only NP-hard problems that are also in NP are NP-complete.

Why questions

Why do we reduce from a known NP-complete problem rather than to it, when proving hardness?
Because means " is at least as hard as ." To crown as hard we must show a known-hard hides inside it, so hardness flows into .
Why does the 3-SAT-to-Clique reduction set (number of clauses) rather than something else?
A size- clique is forced to pick exactly one vertex per clause (no edges inside a clause), which corresponds to choosing one satisfying literal from every clause — precisely what satisfaction requires.
Why is "verify" cheap but "find" seemingly expensive, in one sentence?
Verifying checks a single given certificate against the rules, while finding must search a possibly exponential space of candidate certificates for a valid one.
Why does making missing edges cost 2 (not ) still work in the Hamiltonian-to-TSP reduction?
Any tour using even one weight-2 edge costs , so the budget already forbids fake edges; a finite penalty of 2 is enough and keeps the graph a clean complete weighted graph.
Why is SAT the natural "root" of the whole NP-complete chain?
Cook–Levin encodes any NP machine's accepting computation as a Boolean formula, so SAT captures all of NP at once — making it the seed from which every other hardness proof grows via Polynomial-time Reductions.
Why does the Subset Sum gadget add slack numbers to each clause column?
A satisfied clause may contribute 1, 2, or 3 true literals, but the target fixes each clause column to 3. Slack values (1 and 2) let the subset top up any shortfall so the digit lands exactly on 3.

Edge cases

What is a clique of size , and does every non-empty graph contain one?
A single vertex, trivially "all pairwise adjacent" (there are no pairs to violate). Yes — any graph with vertex has a clique of size 1.
Is the empty set a valid independent set? What vertex cover does it correspond to?
Yes — with no vertices there are trivially no internal edges. Its complement is all of , the largest (and always valid) vertex cover.
For Subset Sum with target , is the answer always yes?
Yes, if the empty subset is allowed: the empty sum is 0. This boundary case is why problem statements must state whether the empty subset counts.
Can a graph have a Hamiltonian path but no Hamiltonian cycle?
Yes. A simple path graph has a Hamiltonian path but no cycle, since there's no edge closing back to . The two problems are genuinely different.
In the Clique–Vertex-Cover duality, what happens when the graph has zero edges?
The whole vertex set is one big independent set (and clique in ), and the empty set is a valid vertex cover of size 0 — the duality still holds with .
If a problem is in P, is it NP-complete?
Not unless P = NP. A P-problem is in NP, but calling it NP-complete would mean every NP problem reduces to it, collapsing the whole hierarchy — the unresolved million-dollar claim.
What does it mean for the TSP decision version to answer "no" for every budget below ?
On the reduced graph, no tour can cost less than (a cycle needs edges each costing ), so any budget is trivially unsatisfiable — the interesting threshold sits exactly at .
Recall One-line summary to carry away

Reductions flow hardness forward ( makes hard); NP is about checkable, not solvable; and "pseudo-polynomial" () is not polynomial because numbers hide exponential size in their bits.