GATE / CS ARCHIVE

SUBJECT COLLECTION

Theory of Computation · Complexity & Reductions

10 questions, newest first

GATE CSE has asked 10 questions on Complexity & Reductions (Theory of Computation) from 1995 to 2015, in 9 of the 46 papers; the most recent is in GATE CSE 2015 Set 3. In the last five years it carried 0 marks per 100-mark paper on average, against 0.3 since 2003. Since 2014 the questions have been 4 MCQ. 1 group of questions here are solved the same way; “One per method” keeps the newest of each.

Not in the GATE 2027 syllabus. Complexity classes (P, NP, NP-complete) and reductions are not named; the section ends at Turing machines and undecidability.

Browse topics
1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Complexity & Reductions

Question 26, GATE 2015: Q1≤p3-SAT≤pQ2. Which is “consistent” with this? A Q1 in NP, Q2 NP-hard; B Q2 in NP, Q1 NP-hard; C both in NP; D both NP-hard. Official choice interprets the question as what is necessarily implied.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: A is guaranteed; all choices can be consistent

A polynomial reduction Q1≤p3-SAT implies Q1∈NP, by composing the reduction with a 3-SAT verifier. The reduction 3-SAT≤pQ2 makes Q2 NP-hard. Thus A is necessarily implied. The literal word consistent is weaker: taking Q1=Q2=3-SAT satisfies all four options simultaneously. The key A requires reading the question as asking what is guaranteed, not merely possible.

A reduction from Q1 to 3-SAT converts a Q1 instance in polynomial time and lets an NP verifier check the resulting formula certificate, so Q1 belongs to NP. A reduction in the other direction from an NP-complete problem to Q2 shows Q2 is at least as hard as every NP problem, so it is NP-hard; it need not belong to NP. These are directional implications, not equivalence. Literal consistency is weaker than logical entailment: choosing both problems equal to 3-SAT makes every listed classification possible, which is why the source wording is explicitly qualified.

Original paper, page 34 · Answer key

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Complexity & Reductions

Question 41, GATE 2015: Suppose L1 is polynomial-time reducible to L2, L3 is polynomial-time reducible to L2, and L2 is polynomial-time reducible to L4. Which statements follow? I: If L4∈P, then L2∈P. II: If L1∈P or L3∈P, then L2∈P. III: L1∈P iff L3∈P. IV: If L4∈P, then L1∈P and L3∈P. Options: (A) II only; (B) III only; (C) I and IV only; (D) I only.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. The reductions are L1≤pL2, L3≤pL2, L2≤pL4.

2. If L4∈P, compose reductions with its decider to place L2, L1, L3 in P. Thus I and IV. Easy source languages do not imply an easy target; L1 and L3 need not share complexity. For example choose one empty and the other a non-P language reducing to the common target. Hence C.

Original paper, page 67 · Answer key

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Complexity & Reductions

Question 38, GATE 2014: Suppose a polynomial-time algorithm finds a largest clique in any graph. Which Venn diagram then describes P, NP and NP-complete (NPC)? A: NP is an outer region containing disjoint P and NPC regions. B: P and NP partially overlap, with NPC in their intersection. C: P=NP is the outer region and NPC is a proper inner subset. D: P=NP=NPC is one region.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Our answer: C under standard many-one completeness; official D simplifies away trivial languages

1. Method and setup. The optimization algorithm decides whether a clique of size at least k exists, placing the NP-complete decision problem CLIQUE in P. Hence every NP problem becomes polynomial-time decidable. The remaining question is whether all members of P qualify as NP-complete under the chosen reduction convention; trivial languages are the important exception.

2. Work through the result and its assumptions. A polynomial maximum-clique algorithm decides CLIQUE in polynomial time, so NP-completeness implies P=NP. Every nontrivial language in P is then NP-complete: decide an NP source and map yes/no instances to fixed yes/no target strings. But ∅ and Σ* are in P and cannot be NP-hard under many-one reductions because a nontrivial language cannot reduce to either. Thus NPC is a proper subset of P=NP, diagram C. Official D is valid only after excluding these trivial languages or changing the reduction convention; keep this discrepancy explicit.

Original paper, page 17 · Answer key

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Complexity & Reductions

Question 38, GATE 2014: 2CNFSAT asks whether a CNF propositional formula with at most two literals per clause is satisfiable; for example (x1∨x2)∧(x1∨¬x3)∧(x2∨x4). Classify it. A NP-complete; B polynomial-time solvable via directed graph reachability; C constant-time solvable because every instance is satisfiable; D NP-hard but not NP-complete.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step 1: Translate every clause (a∨b) into implications ¬a→b and ¬b→a. Treat a unit clause as (a∨a). This gives a directed implication graph with one vertex per literal. Step 2: If x reaches ¬x and ¬x reaches x, they lie in one strongly connected component, so either truth assignment forces a contradiction. Conversely, if no variable shares an SCC with its negation, the SCC ordering yields a satisfying assignment. Step 3: SCCs and reachability are computable in polynomial time (linear time suffices for SCCs), establishing B. C is false, as clauses x and ¬x form an unsatisfiable instance.

Original paper, page 61 · Answer key

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

NP-completeness assuming P differs from NP

Complexity & Reductions

Question 4, GATE 2012: Assuming P ≠ NP, which of the following is TRUE?
       (A) NP-complete = NP                                  (B) NP-complete ∩ P = ∅
       (C) NP-hard = NP                                      (D) P = NP-complete
Tap to enlarge
Your answer
Answer & solution

Official answer: B

If an NP-complete language belonged to P, every language in NP could be reduced to it in polynomial time and then decided in polynomial time. This would imply P=NP, contrary to the premise. Thus NP-complete∩P=∅, B. In particular, NP-complete cannot equal NP because P is a nonempty subset of NP.

Check: NP-completeness combines membership in NP with polynomial reductions from every NP language. The contradiction uses both properties: a polynomial algorithm for one complete problem would compose with those reductions to solve all NP problems.

Original paper, page 2 · Answer key

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Reductions to and from an NP-complete problem

Complexity & Reductions

Question 16, GATE 2006: S is NP-complete. Q and R are problems not initially known to belong to NP. Q is polynomial-time reducible to S and S is polynomial-time reducible to R. Which statement necessarily follows?
Options:
(A) R is NP-complete
(B) R is NP-hard
(C) Q is NP-complete
(D) Q is NP-hard
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. Every NP language reduces to S, and S reduces to R, so transitivity makes R NP-hard. R need not belong to NP and therefore need not be NP-complete.

2. Q reducing to S does place Q in NP, but does not make Q NP-hard. Thus B.

3. Teaching check: Reduction direction matters: if A reduces to B, a solver for B can solve A. Thus hardness flows from S toward R. Membership in NP does not automatically flow in that direction, which is why NP-hard is justified but NP-complete is not.

Original paper, page 2

2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Hamiltonian cycles on a multiple of three vertices

Complexity & Reductions

Question 31, GATE 2006: Restrict undirected graphs G=(V,E) to |V| divisible by 3. SHAM₃ is the problem of finding a Hamiltonian cycle; DHAM₃ asks whether one exists. Which statement is true?
Options:
(A) Both DHAM₃ and SHAM₃ are NP-hard
(B) SHAM₃ is NP-hard but DHAM₃ is not
(C) DHAM₃ is NP-hard but SHAM₃ is not
(D) Neither is NP-hard
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. The vertex-count restriction does not remove NP-hardness. Reduce an undirected Hamiltonian-cycle instance by replacing each original vertex with a three-vertex path.

2. For each original edge uv, connect each endpoint of u’s path to each endpoint of v’s path. The middle vertices have degree 2, so any Hamiltonian cycle must traverse each replacement path; contracting the paths recovers a Hamiltonian cycle of the original graph.

3. Conversely any original cycle expands through all paths. The new graph has 3|V| vertices.

4. Therefore decision DHAM3 is NP-hard; a polynomial search algorithm that returns a cycle or reports none would decide it, so SHAM3 is NP-hard as well, A.

5. Teaching check: The middle vertex in each three-vertex replacement path has degree two, forcing both its incident edges into any Hamiltonian cycle. Hence the whole path acts as one original vertex when contracted. This gives an explicit polynomial reduction rather than assuming a divisibility restriction preserves hardness.

Original paper, page 4

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Complexity of two-SAT and three-SAT

Complexity & Reductions

Question 30, GATE 2004: Which complexity classification applies to 3-SAT and 2-SAT respectively?
Options:
(A) Both in P
(B) Both NP-complete
(C) NP-complete and in P
(D) Undecidable and NP-complete
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Step 1: 3-SAT is NP-complete.2-SAT is decidable in polynomial time, for example by strongly connected components of its implication graph, so C. These classifications are established without assuming P≠NP; saying 3-SAT is NP-complete is not a proof that it lies outside P.

Step 2: Teaching check: For 2-SAT, clause (u∨v) adds implications ¬u→v and ¬v→u. The formula is unsatisfiable exactly when some variable and its negation occupy one strongly connected component. This polynomial algorithm is why one cannot extend the 3-SAT hardness conclusion to two literals.

Original paper, page 4

1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Two directions of an NP-completeness proof

Complexity & Reductions

Question 12, GATE 2003: Ram gives a polynomial-time reduction from 3-SAT to decision problem Π. Shyam gives a polynomial-time reduction from Π to 3-SAT. What follows? A. Π is NP-hard but not NP-complete; B. Π is in NP but not NP-complete; C. Π is NP-complete; D. Π is neither NP-hard nor in NP.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Reduction direction matters: 3-SAT≤pΠ means a solver for Π could solve an NP-complete problem, proving hardness. For membership, compute the other reduction and use a satisfying assignment to the resulting 3-CNF as a polynomial certificate. Combining membership and hardness is precisely NP-completeness.

2. The reduction 3-SAT≤pΠ proves Π is NP-hard. The reduction Π≤p 3-SAT supplies a polynomial verifier/NP algorithm because 3-SAT is in NP, so Π is in NP. Together these establish NP-completeness, C, for the standard decision-problem reductions.

Original paper, page 2

5 marks · Descriptive
Not in GATE 2027 syllabusReport issue

Certify the complement of a thin NP language

Complexity & Reductions

Question 11, GATE 1995: L⊆Σ* is in NP and contains exactly one string of each length n. Prove its complement is in NP.
Tap to enlarge
Answer & solution

Answer: For x, certify a different same-length y∈L using its NP witness. (no official key was published)

Since L is in NP, there is a polynomial-time verifier V(y,c) and a polynomial bound on certificates c such that y∈L exactly when some c makes V accept. To verify that x is in the complement, guess a pair (y,c), require |y|=|x| and y≠x, and run V(y,c). Accept precisely when all checks pass.

Completeness: if x∉L, the hypothesis guarantees a string y∈L of length |x|. It cannot equal x, and it has an accepting NP certificate, so the new verifier has an accepting guess. Soundness: if x∈L, uniqueness says no different same-length y lies in L. Therefore no proposed pair can pass all checks.

The guessed y has length n, its certificate has polynomial length in n, and both comparison and verification take polynomial time. This proves the complement is in NP without assuming NP=coNP. Both parts of “exactly one” matter: existence supplies a witness on complement instances, while uniqueness prevents false acceptance on member instances. At length zero the only word is ε, which is in L, and no different same-length word exists, so rejection is correct.

Original paper, page 7