Skip to content
Official PYQ · 2004

GATE CS 2004 Q30 — Asymptotic Worst Case Time and Space Complexity

Explain with AI

The problem 3-SAT\text{3-SAT} and 2-SAT\text{2-SAT} are 

Choose one option
View worked solution

Answer: C

The correct option is C.

Here is the classification of both problems:

  • 3-SAT: This is a classic NP-complete problem. It is a special case of the Boolean satisfiability problem where each clause contains exactly three literals. It was one of Richard Karp's original 21 NP-complete problems.
  • 2-SAT: This problem restricts each clause to have at most two literals. Unlike 3-SAT, 2-SAT can be solved in polynomial time, placing it in P.

Polynomial-time algorithm for 2-SAT:
A 2-SAT instance can be represented as an implication graph, where each clause (u∨v)(u \lor v) is equivalent to two implications: (¬u  ⟹  v)(\neg u \implies v) and (¬v  ⟹  u)(\neg v \implies u). By constructing this directed graph and finding its Strongly Connected Components (SCCs) using Kosaraju's or Tarjan's algorithm, we can determine satisfiability in O(V+E)O(V + E) linear time. If no variable xx and its negation ¬x\neg x lie in the same SCC, the formula is satisfiable.

Thus, 3-SAT is NP-complete and 2-SAT is in P.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Asymptotic Worst Case Time and Space Complexity questions