Data Structures & AlgorithmsHardGATE CS · ICPC regional
An undirected graph has the vertices B, D, O, Q, T, X and the edges D–Q, X–D, B–D, X–Q, O–D, X–T, B–Q, D–T, X–O. 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. 4
- C. 3
- D. 2
Correct answer: D. 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
- A directed acyclic graph has the vertices A, E, F, J, L, N and the arcs F→N, F→E, F→J, F→A, L→E, N→E, E→A, J→A. Two players alternately…
- A bipartite graph has left side P1, P2, P3, P4 and right side Q1, Q2, Q3, Q4, Q5, with edges P1–Q1, P4–Q1, P1–Q2, P1–Q5, P4–Q5, P2–Q5…
- A tree has vertices with weights in brackets: Y[6], L[12], B[1], X[10], W[6], I[3], N[4], V[14], J[7]. The edges are Y–L, Y–B, L–X, L–W…
- A directed graph has the vertices D, F, M, O, S and the arcs M→D, M→O, D→O, D→F, O→S, F→O, S→M. Count the directed Hamiltonian paths…
- On an 7×7 chessboard, rows and columns are numbered 0 to 6, and squares are written (row, column). A knight moves in the usual L-shape…
- A directed acyclic graph has the vertices A, F, J, K, P, R, S and the edges P→A, P→F, A→F, J→F, J→S, J→R, S→F. A topological order lists…