Data Structures & AlgorithmsHardGATE CS · ICPC regional
Directed graph on vertices A, B, C, D, E, F, G with edges E→B, B→F, C→D, A→G, F→D, G→F, D→C, G→B, C→G (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. 4
- C. 3
- D. 7
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 7.
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
- Undirected weighted graph on vertices A, B, C, D with edges A–B (1), A–C (2), A–D (2), B–C (1), B–D (3), C–D (2). How many distinct…
- Directed acyclic graph on vertices A, B, C, D, E, F, G, H (every edge goes from a smaller to a larger letter) with weighted edges A→C (4)…
- Array A = [2, 1, 2, 3, 3, 4, 1, 5]. An increasing subsequence is chosen by INDEX positions i1 < i2 < … with A[i1] < A[i2] < … (strictly…
- Distinct words ['bb', 'c', 'b', 'ac', 'cab'] are inserted into an empty trie (one node per character, shared prefixes share nodes, and a…
- Connected undirected graph on vertices A, B, C, D, E, F, G, H with edges A–D (1), A–H (1), B–D (1), B–E (1), B–F (1), B–H (1), C–F (1)…
- Connected undirected weighted graph on vertices A, B, C, D, E, F with edges A–C (5), A–F (7), B–E (5), C–E (9), C–F (20), D–E (20), D–F…