Data Structures & AlgorithmsHardGATE CS · Codeforces Div 2 B
An undirected graph has the vertices D, K, R, S, X, Y and the edges Y–R, S–X, D–S, Y–D, Y–S, R–K, R–X, D–R, R–S, D–X. 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. 4
- B. 7
- C. 5
- D. 3
Correct answer: D. 3
Trying all deletion sets of increasing size finds 3. Deleting vertices instead needs 2 vertex deletions, and the cyclomatic number m − n + 1 = 5 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 connected undirected graph has the vertices E, H, O, P, V, W, X and weighted edges (weights in brackets): E–P (4), O–W (16), X–H (8)…
- A directed acyclic graph has the vertices I, K, O, Q, T, U, X, Z and the directed edges K→Z, U→K, U→Z, T→K, X→I, X→K, O→K, T→I, X→U, X→O…
- A flow network has source S and sink T, with directed arcs and capacities in brackets: S→D (9), S→A (2), S→B (9), S→T (3), A→D (7), A→T…
- A directed acyclic graph has the vertices C, F, K, Q, S, V, W and the directed edges Q→C, V→W, F→C, K→F, V→Q, S→Q, W→F, K→S, K→C, S→C. How…
- An undirected graph has the vertices H, K, N, T, U, X and the edges X–H, X–U, X–K, H–K, N–T, N–U, N–K, U–K. What is its chromatic number…
- Consider this function: python def g(n): if n < 3: return n if n % 2 == 0: return g(n - 3) + g(n - 3) return g(n - 1) - 1 What value does…