GATE Computer ScienceVery hardGATE CS (PYQ pattern)

What is the minimum weight of a spanning tree that must contain the edge 3-4 (weight 15) in the graph with edges 0-1 (7), 0-3 (5), 1-2 (8), 1-3 (9), 1-4 (10), 2-4 (6), 3-4 (15), 3-5 (11), 4-5 (12), 4-6 (13), 5-6 (14)?

  1. A. 50
  2. B. 65
  3. C. 67
  4. D. 57

Correct answer: D. 57

Force edge 3-4 and then run Kruskal on the rest. The unconstrained MST (weight 50) does not contain it; adding 3-4 creates a cycle whose heaviest other tree edge is 8 (1-2), and swapping it in gives 50 − 8 + 15 = 57.

More Algorithms questions

Exams that ask this topic