Data Structures & AlgorithmsVery hardICPC regional · Codeforces Div 2 E
Directed graph on vertices 0 to 7 with edges: 4→1, 3→0, 1→6, 5→6, 6→7, 5→3, 6→5, 3→6, 5→4, 5→0, 4→2, 4→5, 1→2, 5→7, 2→1. 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 8 with edges: 6→0, 0→2, 1→8, 3→5, 0→5, 1→0, 1→3, 5→8, 5→0, 4→6, 5→7, 6→7, 8→1, 3→4. How many strongly…
- Directed graph on vertices 0 to 5 with edges: 5→4, 2→3, 4→3, 3→1, 1→0, 2→5, 4→1, 4→2, 0→1. How many strongly connected components does it…
- Directed graph on vertices 0 to 6 with edges: 1→0, 4→2, 6→0, 3→0, 5→3, 5→0, 0→5, 1→4, 2→3. How many strongly connected components does it…
- Directed graph on vertices 0 to 5 with edges: 4→0, 0→3, 4→2, 5→1, 2→0, 5→2, 1→2, 3→2, 3→0. How many strongly connected components does it…
- Directed graph on vertices 0 to 6 with edges: 5→3, 4→3, 3→6, 5→6, 5→2, 2→1, 3→4, 1→0, 2→0, 1→5, 0→2, 0→5. How many strongly connected…
- Directed graph on vertices 0 to 6 with edges: 5→4, 4→3, 2→4, 3→2, 2→5, 4→2, 2→1. How many strongly connected components does it have…