Data Structures & AlgorithmsModerateTCS NQT · trees

Problem: Which theorem states that every tree on n vertices has exactly n - 1 edges?

  1. A. Fermat's little theorem
  2. B. A consequence of connectivity with no cycles
  3. C. The Chinese remainder theorem
  4. D. Dilworth's theorem

Correct answer: B. A consequence of connectivity with no cycles

A tree is a minimally connected acyclic graph, so it has exactly n - 1 edges.

More Coding Interview Problems questions

Exams that ask this topic