Find the centre by peeling
transcript
A ride app has zones joined by roads. The roads form a tree. No zone is the root. All zones are equal. Which zone has the smallest reach?
Remove every leaf at once, in one round. New leaves appear after that. Remove those in the next round. Repeat until two zones are left.
Take six zones. The leaves are zones zero, one, two and five. Remove them all. Zones three and four remain, and we stop. Both have a reach of two. Every other zone has a reach of three.
Stop as soon as two zones are left. A tree can have two centres. Stop at one, and the last round removes both zones.
Trying every zone as a root costs ten billion steps. Peeling costs one pass over all the zones. Even a path of a hundred thousand zones is fine.
Remove the leaves in rounds. Stop at two zones. Full breakdown in the lecture.