GATE Computer ScienceVery hardGATE CS (PYQ pattern)
What is the minimum weight of a spanning tree that must contain the edge 3-4 (weight 15) in the graph with edges 0-1 (7), 0-3 (5), 1-2 (8), 1-3 (9), 1-4 (10), 2-4 (6), 3-4 (15), 3-5 (11), 4-5 (12), 4-6 (13), 5-6 (14)?
- A. 50
- B. 65
- C. 67
- D. 57
Correct answer: D. 57
Force edge 3-4 and then run Kruskal on the rest. The unconstrained MST (weight 50) does not contain it; adding 3-4 creates a cycle whose heaviest other tree edge is 8 (1-2), and swapping it in gives 50 − 8 + 15 = 57.
More Algorithms questions
- Lazy-deletion Dijkstra (a new heap entry is pushed whenever a label improves; stale entries are skipped when popped) runs from A on the…
- A directed graph has edges 0→1 (3), 1→2 (2), 2→0 (4), 1→3 (1), 3→4 (5), 4→1 (−1), 2→4 (6), 4→0 (2), 3→0 (1). What is the minimum mean…
- How many spanning trees does K₅ minus one edge have (5 vertices, all pairs joined except one)?
- How many times does x++ execute? for (i = 1; i < 200; i = 2) for (j = i; j < 200; j += i) x++;
- The solution of the recurrence T(n) = 2T(n/2) + n/log n (with T(1) = 1, logs base 2) is:
- The solution of T(n) = 4T(n/2) + n² log n is: