Data Structures & AlgorithmsModerateICPC regional · graph theory

Problem: An undirected connected graph has an Euler circuit (a closed walk using every edge exactly once) if and only if which condition holds?

  1. A. Exactly two vertices have odd degree
  2. B. Every vertex has odd degree
  3. C. Every vertex has even degree
  4. D. The graph is a tree

Correct answer: C. Every vertex has even degree

Euler's theorem: a connected graph has an Euler circuit exactly when all degrees are even, and an Euler path (not circuit) needs exactly two odd vertices. Two odd vertices is the trap for the path condition.

More Coding Interview Problems questions

Exams that ask this topic