Data Structures & AlgorithmsVery hardProduct-company MCQ pattern
An undirected connected graph has edges A–B, B–C, C–D, D–E, E–F, F–G, G–H, C–G, A–C. How many articulation points (cut vertices) and how many bridges does it have?
- A. 2 articulation point(s), 1 bridge(s)
- B. 1 articulation point(s), 2 bridge(s)
- C. 1 articulation point(s), 1 bridge(s)
- D. 2 articulation point(s), 0 bridge(s)
Correct answer: A. 2 articulation point(s), 1 bridge(s)
Removing each vertex (or edge) in turn and checking whether the graph stays connected identifies 2 cut vertices and 1 bridges here. A bridge's endpoints are cut vertices unless one of them is a leaf, and a vertex can be a cut vertex even where no single edge is a bridge (e.g. it joins two otherwise-separate cycles).
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
- What are the time complexities of P and Q? c int P(int n) { if (n <= 1) return 1; return P(n/2) + P(n/2) + P(n/2) + P(n/2) + n; } int…
- A trie is built from the words {den, dog, car, card, do, cat, deer}. Using the trie (walk the prefix's characters, then count all words in…
- Build a binary min-heap in place from the array [32, 59, 35, 72, 53, 57, 16, 42, 15] using bottom-up heapify (sift-down from the last…
- Keys 47, 33, 29, 18, 55, 67 are inserted via separate chaining (h(k) = k mod 7, new keys appended to the end of the chain) into a table of…
- Undirected graph edges: A–B, C–B, A–D, D–B, C–D, C–A. Using a BFS 2-colouring, is this graph bipartite?
- A disjoint-set (union-find with union by rank and path compression) over 9 elements (0 to 8), each initially its own component, runs this…