Data Structures & AlgorithmsVery hardGATE CS · Product-company placement

The weighted undirected graph A–B (1), A–C (6), A–D (3), A–E (4), B–C (4), B–D (3), C–D (5) has repeated weights. How many different minimum spanning trees does it have, and what is their weight?

  1. A. 1 MST of weight 12
  2. B. 3 MSTs of weight 12
  3. C. 2 MSTs of weight 12
  4. D. 16 MSTs of weight 12

Correct answer: C. 2 MSTs of weight 12

Every MST takes the same multiset of weights; process weight classes in increasing order and count how many ways each class can join the components left by lighter edges. Enumerating all 16 spanning trees confirms 2 reach the minimum 12.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic