Data Structures & AlgorithmsVery hardICPC regional · GATE CS top band

Connected undirected weighted graph on vertices A, B, C, D, E with edges A–C (6), A–D (6), B–C (1), B–D (5), C–E (4), D–E (4). Among all spanning trees whose total weight is strictly greater than the minimum spanning tree weight, what is the smallest possible total weight?

  1. A. 16
  2. B. 20
  3. C. 14
  4. D. 15

Correct answer: A. 16

The minimum spanning tree weighs 15; the true second value is 16, found only by enumerating trees. Swapping just one MST edge for the cheapest non-tree edge is the tempting shortcut that misses it.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic