Data Structures & AlgorithmsVery hardGATE CS (PYQ pattern)
An undirected graph on vertices a-f has edges ab(1), bc(2), ac(2), cd(3), bd(3), de(1), ce(4), ae(4), ef(2), df(2). How many distinct minimum spanning trees does it have?
- A. 6
- B. 4
- C. 8
- D. 12
Correct answer: C. 8
The MST weight is 9: ab and de are forced (weight 1), and then the equal-weight ties are choices of one edge from {bc, ac}, one from {cd, bd}, and one from {ef, df}, giving 2 × 2 × 2 = 8 trees (checked by enumerating all spanning trees).
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- A directed graph has the vertices A, B, C, D, E, F, G, H, I and the arcs A→E, B→E, B→F, D→C, E→B, E→C, G→E, G→I, H→B, H→F, I→C, I→H. What…
- An undirected connected graph has the vertices A–J and the edges A–H, B–E, C–I, C–J, D–E, E–G, E–I, F–I, G–J, H–I, H–J, I–J. How many…
- A graph has the vertices A–F and the edges A–B, A–C, B–C, B–D, C–D, C–E, D–E, D–F, E–F, A–F. How many distinct spanning trees does it have?
- Floyd's bottom-up build-heap (sift-down from the last internal node back to the root) is applied to the array [55, 25, 49, 27, 3, 17, 33…
- Keys 50, 20, 60, 10, 30, 40, 70, 45, 42, 48, 5, 3 are inserted one by one, in this order, into an initially empty AVL tree. A double…
- Keys 10, 20, 30, 40, 50, 60, 70, 80, 15, 25, 35, 45 are inserted in this order into an empty B-tree of minimum degree t = 2 (every node…