Data Structures & AlgorithmsHardGATE CS · Product-company placement

Kruskal's algorithm runs on the weighted undirected graph A–C (29), A–F (19), A–G (2), B–D (8), B–G (25), C–G (14), D–F (1), E–F (11), E–G (27), F–G (7). Which edge is accepted FOURTH, and what is the MST weight?

  1. A. E–F, weight 43
  2. B. B–D, weight 43
  3. C. B–D, weight 48
  4. D. F–G, weight 43

Correct answer: B. B–D, weight 43

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic