Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2
Directed graph on vertices A, B, C, D, E, F with edges A→C, A→D, E→A, D→E, B→D, F→D, D→C, C→A, E→B, F→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. 6
- C. 2
- D. 4
Correct answer: A. 5
Mutual reachability gives components of sizes whose maximum is 5. 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
- Distinct words ['acca', 'cca', 'bb', 'ca', 'cba', 'aa'] are inserted into an empty trie (one node per character, shared prefixes sharing…
- Array A = [9, 8, 3, 6, 4, 2, 6] (indices 0 to 6). Count the non-empty subsets of positions (each position used at most once, subsets not…
- Connected undirected weighted graph on vertices A, B, C, D, E with edges A–B (12), A–C (1), A–E (10), B–D (18), B–E (13), C–D (13), D–E…
- Words ['aaac', 'bac', 'cb', 'ac', 'baab', 'bc', 'bac'] are inserted in this order into an empty trie with one node per character, shared…
- Directed graph on vertices A, B, C, D, E, F with edges F→C, B→A, C→F, D→B, B→F, A→E, E→F, A→C, B→D (no weights). What is the number of…
- Array A = [3, 4, 4, 1, 1, 4, 5, 5]. An increasing subsequence is chosen by INDEX positions i1 < i2 < … with A[i1] < A[i2] < … (strictly…