Data Structures & AlgorithmsHardCodeforces Div 2 · ICPC regional
Directed graph on vertices A, B, C, D, E, F, G with edges F→B, E→B, G→E, C→G, E→D, F→D, F→C, F→E, G→F, C→B, G→A. How many strongly connected components does it have? Count each vertex's component, including single vertices that have no cycle through them.
- A. 2
- B. 1
- C. 5
- D. 4
Correct answer: C. 5
Mutual-reachability classes give 5 strongly connected components; weakly connected components ignore direction and give 1.
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
- Keys [49, 47, 26, 15, 3, 33, 12, 19, 21] are inserted, in this order, into an empty AVL tree using the standard rebalancing (left, right…
- Directed weighted graph on vertices A, B, C, D, E with edges A→C (6); A→E (2); C→A (-2); C→B (1); D→A (1); E→C (5); C→E (3); E→D (2); D→E…
- Rooted tree with root 0 and vertices 0 to 8; the edges are 0–1, 1–2, 2–3, 1–4, 1–5, 4–6, 4–7, 6–8 (parent–child). Every edge has length 1…
- Undirected weighted graph on vertices A, B, C, D, E, F; its edges, in this listed order, are: B–E (3), C–E (4), B–C (8), E–F (2), D–F (7)…
- Array [28, 17, 3, 22, 8, 23, 10] is turned into a min-heap in place with bottom-up heapify: for i from ⌊n/2⌋−1 down to 0, sift the element…
- Bipartite graph with left side {A, B, C}, right side {D, E, F, G} and edges A–D, A–E, B–F, B–G, C–D. What is the size of a maximum…