Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2 B
An undirected connected graph on 6 vertices has the edges (weights in brackets, all distinct): H–E (26), O–E (23), B–O (5), V–U (8), V–B (18), V–O (20), V–H (27), B–E (3). A spanning tree is a set of n − 1 edges with no cycle. What is the weight of the second-smallest spanning tree, meaning the smallest total weight that is strictly larger than the minimum spanning tree weight?
- A. 62
- B. 61
- C. 60
- D. 80
Correct answer: B. 61
The minimum spanning tree weighs 60. Among the other spanning trees the smallest total is 61, obtained by one exchange of an MST edge for a non-tree edge. Adding the cheapest non-tree edge to the MST without the exchange gives 80.
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 tree has the vertices B, E, K, L, N, P, Y, Z and the edges N–E, N–B, E–L, N–K, E–Z, L–P, N–Y. What is the minimum number of vertices…
- An undirected graph has the vertices F, I, N, P, X, Y and the edges F–X, F–P, P–Y, P–X, I–Y, F–I, F–Y, F–N, N–I, I–X. What is the minimum…
- A directed graph has the vertices A, H, R, U, V, Y and the arcs V→A, A→H, A→R, U→R, H→R, Y→R, R→A, R→U, R→H. How many strongly connected…
- A directed graph has the vertices A, D, E, I, U and the arcs E→A, E→I, A→E, A→D, D→E, D→I, D→U, I→A, U→E, U→A, U→D. Count the directed…
- An undirected graph has the vertices A, G, N, O, S and the edges O–N, G–S, S–O, S–A, A–N, A–O, S–N. How many simple cycles does it contain…
- A bipartite graph has left side P1, P2, P3 and right side Q1, Q2, Q3, Q4, Q5, with edges P2–Q2, P3–Q1, P2–Q1, P1–Q5, P1–Q4, P1–Q2. What is…