Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

A tree has the vertices F, H, L, N, O, T, U, V, X and the edges L–O, O–F, L–N, F–H, L–V, O–X, H–U, F–T. A centroid is a vertex whose removal leaves no connected component with more than n/2 vertices. Which vertex is the centroid?

  1. A. O
  2. B. T
  3. C. U
  4. D. N

Correct answer: A. O

Removing O leaves components of at most 4 vertices, while every other vertex leaves a component bigger than n/2. The highest-degree vertex L is a common wrong guess.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic