Data Structures & AlgorithmsVery hardICPC regional · GATE CS

Undirected simple graph on vertices 0 to 5 with weighted edges (u–v (w)): 3–5 (3), 0–5 (3), 1–4 (3), 1–5 (3), 2–4 (3), 2–5 (3), 2–3 (1), 0–2 (2), 3–4 (3). 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. 17
  3. C. 61
  4. D. 126

Correct answer: B. 17

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