Data Structures & AlgorithmsHardGATE CS · ICPC regional
Directed graph on vertices A, B, C, D, E, F, G with edges C→A, E→A, E→G, G→C, G→F, F→C, C→G, C→B (no weights). What is the number of vertices in its largest strongly connected component (maximal set where every vertex can reach every other)?
- A. 5
- B. 2
- C. 6
- D. 3
Correct answer: D. 3
Mutual reachability gives components of sizes whose maximum is 3. Using weakly connected components instead would ignore edge directions and give 6.
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
- On an 8 × 8 chessboard with rows and columns numbered 0 to 7, a knight starts at (4, 7) and must reach (1, 0) (as (row, column)). A knight…
- A trie keeps a counter at each node, and every word of the list W = ['bbaa', 'bc', 'a', 'cbaa', 'ccac', 'a'] is inserted once per…
- A binary trie of 6-bit numbers stores the set S = [25, 51, 62, 29]. For the query x = 53, what is the maximum value of x XOR s over all s…
- Directed graph on vertices A, B, C, D, E, F, G with edges C→F, F→G, F→E, A→D, E→C, C→G, B→F, A→G, B→C, G→C, A→E. How many strongly…
- On an 7 × 7 chessboard with rows and columns numbered 0 to 6, a knight starts at (0, 0) and must reach (5, 1) (as (row, column)). A knight…
- A trie keeps a counter at each node, and every word of the list W = ['ab', 'acc', 'aac', 'bcaa', 'cab', 'ab', 'a'] is inserted once per…