Data Structures & AlgorithmsHardICPC regional · Codeforces Div 2 E
Directed graph on vertices 0 to 7 with edges: 6→7, 1→5, 5→6, 3→4, 6→0, 7→1, 6→5, 1→6, 1→3, 2→3, 7→2. How many strongly connected components does it have (maximal sets in which every vertex can reach every other)?
- A. 1
- B. 2
- C. 0
- D. 5
Correct answer: D. 5
Vertices that can reach each other form one component, giving 5 groups in total. Ignoring edge directions gives only 1 weakly connected pieces, which is the usual slip.
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 5 with edges: 0→4, 5→1, 2→3, 5→2, 4→5, 5→0. How many strongly connected components does it have (maximal…
- Directed graph on vertices 0 to 8 with edges: 3→7, 4→1, 2→8, 6→1, 1→4, 8→0, 6→0, 0→2, 1→5, 0→4, 4→3, 7→4, 0→6, 0→7. How many strongly…
- 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…
- 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…