Data Structures & AlgorithmsVery hardGATE CS · ICPC regional · Product Company SDE

An undirected graph has edges (u–v: weight) A–B:13, A–C:16, A–D:20, C–E:2, B–F:18, D–F:10, D–B:23. What is the weight of its minimum spanning tree?

  1. A. 59
  2. B. 64
  3. C. 61
  4. D. 47

Correct answer: A. 59

Kruskal: sort edges and add the cheapest that does not form a cycle: CE(2), DF(10), AB(13), AC(16), BF(18) → 59. Simply taking the 5 lightest edges may create a cycle.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic