Data Structures & AlgorithmsHardICPC regional · GATE CS

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

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

Correct answer: A. 3

Every minimum spanning tree has total weight 3. Enumerating the (n−1)-edge subsets that are trees shows 3 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