Data Structures & AlgorithmsVery hardCodeforces Div 2 D
Directed graph on vertices 0 to 6 with edges: 0→2, 1→0, 1→5, 3→1, 0→3, 2→5, 4→0. What is the number of vertices in the largest strongly connected component?
- A. 6
- B. 5
- C. 3
- D. 2
Correct answer: C. 3
The largest group in which every vertex reaches every other has 3 vertices. The set reachable from 0 (5 vertices) is not an SCC, and the largest weak component (6) ignores direction.
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 graph on vertices 0 to 8 with edges: 1→3, 0→4, 7→0, 4→5, 2→3, 1→8, 1→6, 0→6, 6→0, 6→1, 0→7, 4→7. What is the number of vertices…
- Directed graph on vertices 0 to 8 with edges: 2→6, 6→3, 2→4, 7→3, 6→4, 5→8, 5→0, 3→2, 5→6, 1→7, 0→5, 4→6, 8→3, 0→6. What is the number of…
- Directed graph on vertices 0 to 8 with edges: 6→5, 6→4, 8→2, 7→5, 4→5, 8→7, 2→6, 8→6, 6→8, 5→6, 0→1, 5→1, 1→5, 3→8, 5→4. What is the…
- Directed graph on vertices 0 to 7 with edges: 2→4, 3→5, 7→4, 6→4, 1→5, 3→4, 1→6, 1→7, 2→7, 6→1, 7→6, 3→2, 1→3, 6→0, 2→5, 4→3, 4→7. What is…
- Directed graph on vertices 0 to 7 with edges: 0→7, 7→4, 3→6, 1→2, 2→1, 7→1, 1→6, 4→5, 4→6, 2→4, 2→0, 2→5, 0→6, 2→6. What is the number of…
- Directed graph on vertices 0 to 5 with edges: 4→3, 0→5, 3→5, 5→3, 3→0, 5→2. What is the number of vertices in the largest strongly…