Data Structures & AlgorithmsHardGATE CS · ICPC regional
Directed graph on vertices A, B, C, D, E, F, G with edges D→A, A→E, E→F, B→F, B→A, F→G, C→D, D→G, E→B, A→F, A→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. 7
- C. 2
- 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 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
- Bipartite graph with left side {A, B, C}, right side {D, E, F, G} and edges A–D, A–F, B–D, B–F, B–G. What is the size of a maximum…
- Directed weighted graph on vertices A, B, C, D, E with edges (u→v, w): E→C (9); C→D (5); C→E (4); A→C (5); B→E (1); C→A (3); E→A (2); B→C…
- Keys [43, 27, 29, 8, 44, 17, 18, 5, 4] are inserted, in this order, into an empty AVL tree using the standard rebalancing (left, right…
- Directed weighted graph on vertices F, E, D, A, B (source F, target B) with edges: F→E (4); F→D (6); D→E (-3); E→B (1); D→B (6); F→B (11)…
- Directed weighted graph on vertices A, B, C, D with edges B→A (1); B→C (5); C→D (-1); B→D (-1); C→A (-1); D→C (-2); A→D (4). Source A. Run…
- Words ['aad', 'cda', 'bb', 'aaa', 'cbc', 'cdb'] (each may be used at most once). A chain is a sequence of these words in which the first…