Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2
Connected undirected weighted graph on vertices A, B, C, D, E with edges A–B (12), A–C (1), A–E (10), B–D (18), B–E (13), C–D (13), D–E (7). What is the total weight of a maximum spanning tree (a spanning tree with the largest possible total weight)?
- A. 30
- B. 44
- C. 56
- D. 74
Correct answer: C. 56
Kruskal run on edges in decreasing weight gives 56. 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
- Words ['aaac', 'bac', 'cb', 'ac', 'baab', 'bc', 'bac'] are inserted in this order into an empty trie with one node per character, shared…
- Directed graph on vertices A, B, C, D, E, F with edges F→C, B→A, C→F, D→B, B→F, A→E, E→F, A→C, B→D (no weights). What is the number of…
- Array A = [3, 4, 4, 1, 1, 4, 5, 5]. An increasing subsequence is chosen by INDEX positions i1 < i2 < … with A[i1] < A[i2] < … (strictly…
- Directed graph on vertices A, B, C, D, E, F, G with edges E→B, D→A, C→A, B→E, C→B, F→A, E→D, G→B, B→F, F→G. How many strongly connected…
- Keys [20, 43, 1, 35, 37, 18, 49] are inserted, in this order, into an empty AVL tree using the standard rebalancing (left, right…
- On an 7 × 7 chessboard with rows and columns numbered 0 to 6, a knight starts at (4, 5) and must reach (6, 1) (as (row, column)). A knight…