Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
Connected undirected weighted graph on vertices A, B, C, D, E with edges A–B (3), A–C (3), B–C (3), B–D (3), C–D (1), C–E (4). Among all spanning trees whose total weight is strictly greater than the minimum spanning tree weight, what is the smallest possible total weight?
- A. 13
- B. 14
- C. 10
- D. 11
Correct answer: A. 13
The minimum spanning tree weighs 11; the true second value is 13, found only by enumerating trees. Swapping just one MST edge for the cheapest non-tree edge is the tempting shortcut that misses it.
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
- Connected undirected graph on vertices A, B, C, D, E, F, G, H with edges A–D (1), A–E (1), B–D (1), B–E (1), B–G (1), C–D (1), C–H (1)…
- A binary tree with distinct letters has preorder FBGCHAED and inorder GHACBDEF. What is its postorder traversal (left, right, root)…
- Connected undirected weighted graph on vertices A, B, C, D, E with edges A–B (15), A–C (13), A–D (20), B–D (20), B–E (17), C–D (4), C–E…
- Directed weighted graph on vertices A, B, C, D, E with edges (u→v, w): B→D (1); C→D (7); B→A (4); B→C (1); D→E (7); A→D (7); D→C (3). Let…
- Directed graph on vertices A, B, C, D, E, F with edges D→F, F→B, E→F, D→E, D→B, E→D. How many strongly connected components does it have?…
- Bipartite graph with left side {A, B, C, D}, right side {E, F, G, H} and edges A–E, A–F, A–H, B–G, C–F, C–H, D–E, D–H. What is the size of…