GATE Computer ScienceVery hardGATE CS (PYQ pattern)

A weighted undirected graph on vertices 0–6 has edges (weight) 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. What is (weight of a maximum-weight spanning tree) − (weight of a minimum spanning tree)?

  1. A. 22
  2. B. 7
  3. C. 10
  4. D. 17

Correct answer: D. 17

Minimum (Kruskal ascending): 5, 6, 7, 8, 11, 13 = 50. Maximum (Kruskal descending): 15, 14, 13, 10, 8, 7 = 67 (12, 11, 9, 6, 5 would close cycles). Difference 67 − 50 = 17.

More Algorithms questions

Exams that ask this topic