Data Structures & AlgorithmsModerateCodeforces Div 2 C · GATE CS
An undirected graph has the vertices L, O, Q, Y, Z and the edges L–Z, O–Z, O–Y, Q–O, Q–Y, L–Y, L–Q, Y–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, E, L, M, T and the edges L–E, L–T, M–C, E–C, C–T. In how many ways can each vertex be given one of…
- A directed acyclic graph has the vertices A, F, H, I, K, Q, R and the edges A→H, Q→A, Q→F, Q→H, R→F, F→H, F→K, F→I. A topological order…
- A tree has the vertices A, E, H, P, R, S, T, U, W, Y and the edges H–T, T–E, T–A, E–P, T–Y, A–R, Y–S, R–U, U–W. A set D dominates the tree…
- An undirected connected graph on 6 vertices has the edges (weights in brackets, all distinct): H–E (26), O–E (23), B–O (5), V–U (8), V–B…
- A tree has the vertices B, E, K, L, N, P, Y, Z and the edges N–E, N–B, E–L, N–K, E–Z, L–P, N–Y. What is the minimum number of vertices…
- An undirected graph has the vertices F, I, N, P, X, Y and the edges F–X, F–P, P–Y, P–X, I–Y, F–I, F–Y, F–N, N–I, I–X. What is the minimum…