Data Structures & AlgorithmsHardCodeforces Div 2 · ICPC regional
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 (1), D–E (1). What is the total weight of a maximum spanning tree (a spanning tree with the largest possible total weight)?
- A. 70
- B. 91
- C. 30
- D. 61
Correct answer: A. 70
Kruskal run on edges in decreasing weight gives 70. 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 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…
- Array A = [30, 14, 22, 26, 8, 7] (all values below 32). What is the maximum of A[i] XOR A[j] over all index pairs with 0 ≤ i < j < 6?
- Words ['abd', 'bd', 'dac', 'cac', 'dcb', 'dab', 'dcc'] (each may be used at most once). A chain is a sequence of these words in which the…
- Connected undirected weighted graph on vertices A, B, C, D, E, F with edges A–B (14), A–C (14), A–D (6), A–E (3), B–C (16), B–D (20), B–E…