Data Structures & AlgorithmsHardCodeforces Div 2 C · GATE CS
A connected undirected graph has the vertices F, H, I, M, O, V and the edges F–M, F–I, F–O, M–V, M–H, H–I. How many bridges does it have (edges whose removal disconnects the graph)?
- A. 3
- B. 2
- C. 1
- D. 4
Correct answer: B. 2
Removing each edge in turn and testing connectivity finds 2 bridges. The cyclomatic number m − n + 1 = 1 counts independent cycles, not bridges; there are 2 articulation vertices, and 2 vertices of degree 1.
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
- A counter starts at 1. Each step, you may add 1, add 2, or double the counter. Each step must stay at or below 10. Two sequences of steps…
- An undirected graph has the vertices C, G, I, K, N, W, Y and the edges C–Y, C–I, C–W, C–K, Y–I, Y–W, Y–K, N–I, N–W, G–K, I–K, W–K. What is…
- A directed weighted graph has the arcs u→v (weight): B→U (10), B→S (15), O→U (1), O→S (9), O→P (7), O→L (11), U→O (8), U→S (3), S→L (2)…
- A tree has the vertices D, G, I, J, M, T, X, Y and the edges Y–I, I–J, J–G, J–X, G–T, X–M, Y–D. A set D dominates the tree if every vertex…
- An undirected graph has the vertices D, E, H, K, L, Q, V, Z and the edges Q–H, Q–V, Q–K, L–Z, L–D, E–V, E–K, Z–V, Z–K, H–K, V–D. What is…
- Two unmarked jugs hold 7 litres and 8 litres. Allowed operations: fill a jug completely, empty a jug completely, or pour one jug into the…