Data Structures & AlgorithmsVery hardGATE CS
What is the minimum number of edges that must be deleted from the undirected graph with edges A–B, A–C, A–D, A–E, B–D, B–F, C–E, C–F, D–E, D–F to make it bipartite?
- A. 1
- B. 3
- C. 2
- D. 5
Correct answer: C. 2
Deleting edges to reach a bipartite graph = keeping a maximum cut. The best 2-colouring cuts 8 of the 10 edges, so 2 must go. Counting independent cycles (E − V + 1 = 5) is not the answer.
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
- Dijkstra's algorithm runs from A on the directed graph A→B (14), A→F (2), C→A (12), C→E (7), C→F (2), D→B (7), D→C (5), D→E (3), E→F (6)…
- All suffixes of the string 'abcab' are inserted into a character trie (a suffix trie). How many nodes does it have, including the root?
- Six sorted files have 27, 35, 38, 45, 52, 54 records. Merging two files of sizes a and b costs a + b. What is the minimum total cost to…
- What is the minimum number of edges that must be deleted from the undirected graph with edges A–B, B–C, B–E, B–F, C–D, C–E, C–F, D–F, E–F…
- What does f(3) print? c void f(int n) { if (n <= 0) return; printf("%d", n); f(n - 2); printf("%d", n); f(n - 1); }
- All suffixes of the string 'mississ' are inserted into a character trie (a suffix trie). How many nodes does it have, including the root?