Data Structures & AlgorithmsHardICPC regional · GATE CS top band
Connected undirected weighted graph on vertices A, B, C, D, E, F with edges A–C (5), A–F (7), B–E (5), C–E (9), C–F (20), D–E (20), D–F (3), E–F (11). What is the total weight of a maximum spanning tree (a spanning tree with the largest possible total weight)?
- A. 80
- B. 29
- C. 51
- D. 63
Correct answer: D. 63
Kruskal run on edges in decreasing weight gives 63. Running the usual ascending order returns the minimum tree, which is the trap.
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
- Directed acyclic graph on vertices A, B, C, D, E, F, G with edges F→D, F→C, A→C, A→E, A→G, D→E, E→B. Among all topological orderings…
- Strings a = "ccca" and b = "cbca". The edit distance allows insert, delete and substitute, each costing 1 (the standard Levenshtein…
- Tree with vertices 0 to 8, root 0, edges 0–1, 1–2, 1–3, 1–4, 2–5, 2–6, 6–7, 5–8 (parent–child). Vertex weights (vertex:weight) 0:11, 1:10…
- Array [27, 21, 1, 3, 16, 28, 17] is turned into a min-heap in place with bottom-up heapify: for i from ⌊n/2⌋−1 down to 0, sift the element…
- On an 8 × 8 chessboard with rows and columns numbered 0 to 7, a knight starts at (5, 7) and must reach (0, 5) (as (row, column)). A knight…
- Undirected weighted graph on vertices A, B, C, D, E, F with edges A–B (6), A–E (6), A–F (7), B–C (3), B–D (6), B–F (9), C–E (8), D–F (5)…