Data Structures & AlgorithmsHardGATE CS · Product-company placement

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

  1. A. A–B, weight 65
  2. B. E–F, weight 65
  3. C. E–F, weight 64
  4. D. D–F, weight 65

Correct answer: B. E–F, weight 65

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic