Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2
Directed graph on vertices A, B, C, D, E, F with edges D→F, F→B, E→F, D→E, D→B, E→D. How many strongly connected components does it have? Count each vertex's component, including single vertices that have no cycle through them.
- A. 5
- B. 4
- C. 3
- D. 2
Correct answer: A. 5
Mutual-reachability classes give 5 strongly connected components; weakly connected components ignore direction and give 3.
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, D}, right side {E, F, G, H} and edges A–E, A–F, A–H, B–G, C–F, C–H, D–E, D–H. What is the size of…
- Array A = [30, 14, 22, 26, 8, 7] (all values below 32). What is the maximum of A[i] XOR A[j] over all index pairs with 0 ≤ i < j < 6?
- Words ['abd', 'bd', 'dac', 'cac', 'dcb', 'dab', 'dcc'] (each may be used at most once). A chain is a sequence of these words in which the…
- Connected undirected weighted graph on vertices A, B, C, D, E, F with edges A–B (14), A–C (14), A–D (6), A–E (3), B–C (16), B–D (20), B–E…
- Undirected weighted graph on vertices A, B, C, D, E, F with edges A–C (6), A–D (9), A–E (3), A–F (6), B–C (7), B–E (3), B–F (3), D–F (3)…
- Directed acyclic graph on vertices A, B, C, D, E with edges A→C, A→E, E→B. Among all topological orderings (every edge goes from earlier…