Data Structures & AlgorithmsHardCodeforces Div2 C · ICPC regional

A tree has these edges (given as parent→child; ignore the direction): 84→16, 36→90, 16→92, 92→57, 57→37, 36→41, 36→84, 57→67. The eccentricity of a node is its largest distance, in edges, to any other node. Which node is the centre, the unique node of minimum eccentricity?

  1. A. 84
  2. B. 92
  3. C. 16
  4. D. 36

Correct answer: C. 16

The centre is the middle vertex of a diameter path (here diameter 6 edges, middle node 16); its eccentricity is the smallest. The node one step off the middle, the highest-degree node or the root are traps.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic