All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · December 2022 Shift 2

For the weighted graph below, which of the following orders of adding edges can NOT be produced by a minimum spanning tree algorithm?
Edges (weight): a–b (1), d–f (1), b–f (2), c–d (2), b–c (3), d–e (3), b–d (4), c–e (4), e–f (5), a–c (6), c–f (7)
I. a-b II. d-f III. b-f IV. d-c V. d-e
Choose the correct answer from the options given below:

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. II, I, III, V, IV

Explanation

MST = {a-b, d-f, b-f, c-d, d-e}, weight 9. Kruskal must add edges in non-decreasing weight, so A, B and D are valid. C adds d-e (3) before d-c (2), which Kruskal never does. Prim cannot produce it either, since a-b is not adjacent to the tree {d, f}.

More Data Structures and Algorithms questions