Data Structures & AlgorithmsVery hardICPC regional · Codeforces Div 2 E
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 connected components does it have (maximal sets in which every vertex can reach every other)?
- A. 1
- B. 3
- C. 2
- D. 0
Correct answer: B. 3
Vertices that can reach each other form one component, giving 3 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 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…
- 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…