Data Structures & AlgorithmsHardICPC regional · MST round

Problem: Consider a connected undirected graph whose edge weights are all distinct. Which statement is true?

  1. A. Kruskal's algorithm can produce a different MST than Prim's
  2. B. The MST is unique only when the graph is a tree
  3. C. Negative weights are required for uniqueness
  4. D. Its minimum spanning tree is unique

Correct answer: D. Its minimum spanning tree is unique

If all weights are distinct, the lightest edge across every cut is unique, so the MST is unique. Ties are what allow several minimum spanning trees.

More Coding Interview Problems questions

Exams that ask this topic