Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

A connected undirected graph has the vertices B, E, F, O, Q and weighted edges (weights in brackets): B–O (11), F–O (10), B–Q (13), Q–E (19), O–E (16), F–B (19), B–E (20), F–Q (10), O–Q (4). What is the total weight of a minimum spanning tree?

  1. A. 55
  2. B. 41
  3. C. 74
  4. D. 42

Correct answer: B. 41

Kruskal's algorithm (take the cheapest edge that does not form a cycle) gives 41. A heaviest-first spanning tree gives 74, and a shortest-path tree rooted at F gives 55.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic