Data Structures & AlgorithmsHardICPC regional · GATE CS

Problem: What is the independence number of the cycle graph C7 (the maximum number of vertices with no two adjacent in the 7-cycle)?

  1. A. 3
  2. B. 4
  3. C. 2
  4. D. 5

Correct answer: A. 3

Pick vertices with gaps of at least two around the cycle. For an odd cycle of length 7 the best is floor(7/2) = 3, since 4 vertices would force two neighbours together.

More Coding Interview Problems questions

Exams that ask this topic