Data Structures & AlgorithmsHardGATE CS

Kruskal's algorithm runs on the weighted undirected graph A–D (13), A–F (22), B–F (5), B–G (19), C–D (12), C–G (17), D–F (27), D–G (20), E–F (7), E–G (15). Which edge is accepted FOURTH, and what is the MST weight?

  1. A. E–G, weight 69
  2. B. A–D, weight 69
  3. C. A–D, weight 71
  4. D. C–D, weight 69

Correct answer: B. A–D, weight 69

Edges are taken in increasing weight, skipping any that closes a cycle (rejected: B–G, D–G, A–F…); the accepted edges in order are B–F, E–F, C–D, A–D, E–G, C–G, total 69.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic