Data Structures & AlgorithmsHardCodeforces Div 2 D · ICPC regional

A connected undirected graph has the vertices E, F, J, K, L, W, Y, Z and the edges Y–E, Y–W, E–Z, E–L, E–W, E–J, Z–L, Z–F, W–K. 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)?

  1. A. 3
  2. B. 4
  3. C. 6
  4. D. 9

Correct answer: A. 3

Only odd-degree vertices need fixing; pairing them up with new edges takes 3 edges, one per pair. There are 6 odd-degree vertices, so adding one edge per odd vertex wastes half the work.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic