GATE CS 2015 · Set-1 · Graph Traversals (BFS & DFS)

MCQ · 1 mark · Problem PROG-GRPH-0077

Match the following:\[\begin{array}{ll} \text{(P) Prim's algorithm (minimum spanning tree)} & \text{(i) Backtracking} \\ \text{(Q) Floyd-Warshall (all pairs shortest paths)} & \text{(ii) Greedy method} \\ \text{(R) Mergesort} & \text{(iii) Dynamic programming} \\ \text{(S) Hamiltonian circuit} & \text{(iv) Divide and conquer} \end{array}\]
  1. A
    P-iii, Q-ii, R-iv, S-i
  2. B
    P-i, Q-ii, R-iv, S-iii
  3. C
    P-ii, Q-iii, R-iv, S-i
  4. D
    P-ii, Q-i, R-iii, S-iv

Solve it on GATE DA practice →More Graph Theory & Algorithms problems

Show the worked solution(P) Prim's algorithm adds the cheapest edge leaving the tree at each step: Greedy method (ii).(Q) Floyd-Warshall combines shortest paths through vertices 1..k-1 into those through 1..k: Dynamic programming (iii).(R) Mergesort splits the array in halves, sorts them and merges: Divide and conquer (iv).(S) A Hamiltonian circuit is searched for by extending a partial path and backing up on a dead end: Backtracking (i).Answer: C

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com