Data Structures & AlgorithmsHardGATE CS · Product-company placement

Kruskal's algorithm runs on the weighted undirected graph A–B (20), A–C (3), A–E (8), A–F (6), B–D (10), C–D (1), C–G (16), D–E (25), D–F (9), D–G (23). Which edge is accepted FOURTH, and what is the MST weight?

  1. A. B–D, weight 44
  2. B. A–E, weight 37
  3. C. A–F, weight 44
  4. D. A–E, weight 44

Correct answer: D. A–E, weight 44

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic