Data Structures & AlgorithmsHardICPC regional · graph counting

Problem: What is the number of spanning trees of a cycle graph C_n with n vertices?

  1. A. n - 1
  2. B. 2^n
  3. C. n
  4. D. n^(n-2)

Correct answer: C. n

Removing any one of the n edges of the cycle gives a spanning tree, and no other spanning trees exist.

More Coding Interview Problems questions

Exams that ask this topic