GATE Computer ScienceHardGATE CS (PYQ pattern)

Which of the following statements are correct? (I) 2-SAT can be solved in polynomial time. (II) Subset-sum has a pseudo-polynomial dynamic-programming algorithm, so it is in P. (III) Finding the longest simple path in a general undirected graph is NP-hard. (IV) Deciding whether a planar graph can be coloured with four colours is NP-complete.

  1. A. I, III and IV
  2. B. II and III only
  3. C. I and III only
  4. D. I, II and III

Correct answer: C. I and III only

I is true (implication-graph SCCs) and III is true (it generalises Hamiltonian path). II is false because the DP is polynomial in the numeric value, not the input length, and subset-sum is NP-complete. IV is false since every planar graph is 4-colourable, so the answer is always yes.

More Algorithms questions

Exams that ask this topic