Data Structures & AlgorithmsHardICPC regional · GATE CS

Undirected simple graph on vertices 0 to 4 with weighted edges (u–v (w)): 0–3 (3), 2–3 (3), 1–3 (3), 2–4 (3), 0–4 (3), 3–4 (2), 1–4 (2). How many different minimum spanning trees does this graph have? Two spanning trees are different when their edge sets differ.

  1. A. 1
  2. B. 20
  3. C. 4
  4. D. 2

Correct answer: C. 4

Every minimum spanning tree has total weight 10. Enumerating the (n−1)-edge subsets that are trees shows 4 of them reach that weight, so the MST is not unique; one run of Kruskal hides this.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic