Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div 2 B
An undirected graph has the vertices C, O, Q, W, X, Z and the edges X–Q, Q–C, Q–O, W–C, X–C, O–Z, Q–Z, C–O, X–Z. What is the minimum number of edges that must be deleted so that the remaining graph is bipartite (its vertices can be split into two sets with every edge joining the two sets)?
- A. 1
- B. 2
- C. 4
- D. 3
Correct answer: B. 2
Trying all deletion sets of increasing size finds 2. Deleting vertices instead needs 1 vertex deletions, and the cyclomatic number m − n + 1 = 4 is only a bound on edges removed to break all 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
- An undirected graph has the vertices C, G, T, W, X and the edges C–T, C–G, W–T, W–G, W–X, T–G, G–X. A walk may repeat vertices and edges…
- A grid has 6 rows and 6 columns (top to bottom; '.' open, '#' blocked): ..#... .....# .##... ...... ..#..# ...... You may only move right…
- A counter starts at 1. Each step, you may add 1, add 2, or double the counter. Each step must stay at or below 20. Two sequences of steps…
- A grid has 4 rows and 4 columns (top to bottom; '.' open, '#' blocked): ..## .... .... .... You may only move right or down, and you…
- An undirected connected graph on the vertices D, H, I, K, M has the edges H–K, I–K, D–H, D–M, D–K, D–I, H–M, M–K, H–I. How many spanning…
- An undirected graph has the vertices R, T, V, X and the edges T–R, T–X, T–V, R–V, X–V. A walk may repeat vertices and edges. How many…