Data Structures & AlgorithmsHardICPC regional · GATE CS top band
Connected undirected graph on vertices A, B, C, D, E, F, G, H with edges A–C (1), B–D (1), B–E (1), B–G (1), C–D (1), D–F (1), D–G (1), F–H (1) (weights ignored). How many bridges does it have? A bridge is an edge whose removal disconnects the graph.
- A. 4
- B. 5
- C. 1
- D. 3
Correct answer: B. 5
Removing each edge in turn and testing connectivity gives 5 bridges. Articulation points or the cyclomatic number are different structural counts that a student may mix up.
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, E, F; its edges, in this listed order, are: A–C (7), B–D (9), A–D (6), A–E (5), B–F (6)…
- Points A(5,6), B(6,6), C(4,5), D(7,8), E(7,6) in the plane. The cost of joining two points is the Manhattan distance |x1−x2| + |y1−y2|…
- Dictionary D = {bdc, bds, cat, gce, lpb, nig, pgm, rmm, seg, tgm, tgs, tms} (all words have 3 letters). Starting from the word 'pmm', a…
- Undirected graph on vertices A, B, C, D, E, F with edges, in this exact order: C–D (1), B–C (1), C–E (1), C–F (1), A–D (1), A–C (1)…
- A chain of 5 matrices M1 to M5 has dimensions given by the sequence p = [12, 16, 8, 10, 7, 10], where Mi has size p[i−1] × p[i]…
- A chain of 6 matrices M1 to M6 has dimensions given by the sequence p = [20, 8, 2, 10, 19, 2, 7], where Mi has size p[i−1] × p[i]…