Data Structures & AlgorithmsHardCodeforces Div 2 · ICPC regional
Directed graph on vertices A, B, C, D, E, F with edges C→F, D→E, D→B, F→B, F→C, E→C, F→E, E→A (no weights). What is the number of vertices in its largest strongly connected component (maximal set where every vertex can reach every other)?
- A. 4
- B. 6
- C. 2
- D. 3
Correct answer: D. 3
Mutual reachability gives components of sizes whose maximum is 3. Using weakly connected components instead would ignore edge directions and give 6.
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 weighted graph on vertices A, B, C, D with edges A–B (6), A–C (1), A–D (1), B–C (3), B–D (6), C–D (4). Among all…
- Keys are inserted in the order 78 11 62 12 89 into an empty binary search tree. Then the key 78 (which has two children) is deleted by…
- Complete undirected graph on vertices A to F with symmetric edge weights given row by row (row i, column j = weight of edge between…
- Undirected weighted graph on vertices A, B, C, D, E, F; its edges, in this listed order, are: A–E (2), D–F (6), B–C (8), C–D (4), A–B (7)…
- Array A = [4, 3, 9, 3, 3, 9, 7] (indices 0 to 6). Count the non-empty subsets of positions (each position used at most once, subsets not…
- Distinct words ['aa', 'ab', 'ca', 'c', 'bb'] are inserted into an empty trie (one node per character, shared prefixes share nodes, and a…