Data Structures & AlgorithmsHardICPC regional · GATE CS top band

Undirected weighted graph on vertices A, B, C, D with edges A–B (3), A–C (2), A–D (1), B–C (2), B–D (2), C–D (1). How many distinct minimum spanning trees does it have? Two spanning trees are different if their edge sets differ.

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

Correct answer: C. 2

Enumerating every set of n−1 edges that forms a tree gives 2 trees of the minimum total weight. Assuming the MST is unique, which is what a single Kruskal run suggests, is the trap when weights tie.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic