Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2
Connected undirected weighted graph on vertices A, B, C, D, E with edges A–D (16), A–E (3), B–C (6), B–E (16), C–D (2), C–E (14). What is the total weight of a maximum spanning tree (a spanning tree with the largest possible total weight)?
- A. 25
- B. 49
- C. 32
- D. 57
Correct answer: B. 49
Kruskal run on edges in decreasing weight gives 49. 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 ['cb', 'da', 'abb', 'dbd', 'cd'] (each may be used at most once). A chain is a sequence of these words in which the first letter of…
- Undirected weighted graph on vertices A, B, C, D with edges A–B (2), A–C (3), A–D (3), B–C (3), B–D (2), C–D (3). How many distinct…
- Undirected graph on vertices A, B, C, D, E, F, G with edges A–C (1), A–E (1), A–F (1), B–E (1), B–F (1), B–G (1), C–E (1), D–E (1), E–G…
- Words ['dbd', 'cc', 'bb', 'aca', 'bda', 'ccd'] (each may be used at most once). A chain is a sequence of these words in which the first…
- Distinct words ['ccc', 'cb', 'ac', 'ba', 'cbb', 'cca'] are inserted into an empty trie (one node per character, shared prefixes share…
- Distinct keys [13, 25, 27, 11, 8, 16] are inserted, in the order given by the sequence [25, 13, 8, 27, 16, 11], into an empty binary…