Data Structures & AlgorithmsHardGATE CS · ICPC regional
A connected undirected graph has the vertices F, I, L, R, S, W, Z and the edges R–S, R–I, R–W, S–L, S–Z, I–F, L–Z. Parallel edges are allowed when you add new edges. What is the minimum number of new edges to add so that the graph has an Euler circuit (every vertex has even degree)?
- A. 7
- B. 3
- C. 4
- D. 2
Correct answer: D. 2
Only odd-degree vertices need fixing; pairing them up with new edges takes 2 edges, one per pair. There are 4 odd-degree vertices, so adding one edge per odd vertex wastes half the work.
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
- An undirected graph on 7 vertices has the edges U–Z, U–B, U–J, Z–G, Z–N, G–P, P–B, P–N, P–J, N–J. How many simple paths (no repeated…
- A connected undirected graph has the vertices A, D, J, M, S, Z and the edges M–Z, Z–S, Z–J, Z–A, S–D, S–A, D–A. How many bridges does it…
- A flow network has source S and sink T, with directed arcs and capacities in brackets: S→E (4), S→T (9), C→D (8), C→T (3), B→E (6), B→T…
- A tree has the vertices A, E, G, I, K, L, N, O, W and the edges G–W, W–O, O–E, E–L, G–I, G–A, A–K, O–N. A centroid is a vertex whose…
- A tree has vertices A, B, F, H, I, K, M, Q, S and weighted edges (weights in brackets): Q–S (5), Q–M (4), Q–K (1), S–H (3), Q–A (7), K–B…
- A flow network has source S and sink T, with directed arcs and capacities in brackets: S→E (8), S→T (3), B→E (6), B→T (7), E→T (9), C→E…