Graph Theory37 sections · 1633 units
Open in Course

Read Statement

(Problem link)

Read the full problem statement at the link above. Make sure you understand what a centroid is before continuing. The definition is precise: no component can have more than n/2\lfloor n/2 \rfloor nodes. The core constraint: after removing the centroid, each remaining component has at most n/2\lfloor n/2 \rfloor nodes. This includes the parent direction if you are rooting the tree. Try to think of an algorithm before reading further. How would you check if a node is a centroid?

How would you find one efficiently?