Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
An undirected graph has the vertices A, D, F, P, U, Y and the edges P–A, Y–A, D–A, D–U, Y–F, D–F, P–F, U–A, Y–D, F–U. 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. 2
- B. 5
- C. 4
- D. 1
Correct answer: A. 2
Trying all deletion sets of increasing size finds 2. Deleting vertices instead needs 1 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 directed acyclic graph has the vertices D, L, P, Q, R, U, V and the edges V→R, Q→R, U→R, U→Q, U→D, U→P, L→Q. A topological order lists…
- Consider this recursive function: python def f(n): if n <= 0: return f(n - 2) if n % 3 == 0: f(n - 2) How many times is f called in total…
- A counter starts at 1. Each step, you may add 1, add 2, or double the counter. Each step must stay at or below 22. Two sequences of steps…
- Starting from the integer 9, one operation either adds 1, subtracts 1, or doubles the current value. Values may be any non-negative…
- An undirected graph has the vertices A, O, S, T, V, Y and the edges Y–V, T–A, T–V, O–T, O–A, Y–A, S–V, O–S, V–A. What is the minimum…
- An undirected graph has the vertices M, O, U, Y and the edges U–O, U–Y, M–O, O–Y. In how many ways can each vertex be given one of 3…