Data Structures & AlgorithmsVery hardGATE CS · Product-company placement
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 to make it bipartite?
- A. 1
- B. 2
- C. 3
- D. 4
Correct answer: B. 2
Deleting edges to reach a bipartite graph = keeping a maximum cut. The best 2-colouring cuts 7 of the 9 edges, so 2 must go. Counting independent cycles (E − V + 1 = 4) 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
- 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?
- Keys 14, 86, 32, 49, 38, 76, 17, 91, 35, 81, 16 are inserted in that order into an empty BST. Then 32 is deleted and after that 86 is…
- The weighted undirected graph A–B (2), A–E (1), B–C (6), B–D (1), B–E (2), C–D (6), D–E (3) has repeated weights. How many different…
- What is the edit distance (insert, delete, substitute; each cost 1) between SUBSEQUENT and PLATFORM?
- Dijkstra's algorithm runs from A on the directed graph A→B (4), A→F (8), B→C (1), B→D (10), C→A (3), C→D (8), C→E (6), C→F (6), E→B (1)…