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.
- A. I, III and IV
- B. II and III only
- C. I and III only
- 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
- An AVL tree is a binary search tree in which the heights of the two subtrees of every node differ by at most 1. Taking the height of a…
- A B-tree has minimum degree t = 3 (every node other than the root holds between t − 1 and 2t − 1 keys; the root holds at least 1 key) and…
- A DAG has vertices 1 to 8 and edges 1→3, 2→3, 3→4, 3→5, 2→6, 6→5, 4→7, 5→7, 8→6, 1→8. How many different topological orderings does it have?
- A directed graph on vertices 0 to 11 has edges 0→1, 1→2, 2→0, 2→3, 3→4, 4→3, 5→3, 5→6, 6→7, 7→6, 8→9, 9→10, 10→8, 10→5, 11→3. What is the…
- An undirected graph has vertices 0 to 13 and edges 0-1, 1-2, 2-0, 2-3, 3-4, 4-5, 5-3, 5-6, 6-7, 7-8, 8-6, 1-9, 9-10, 10-11, 11-9, 4-12…
- In how many different ways can the 10 distinct keys 1, 2, ..., 10 be arranged in the array positions 1 to 10 of a binary max-heap (each…