Tree Diameter
DFS Twice
Pick a random node
i.DFS to find the furthest node
jto nodei.DFS to find the furthest node
kto nodej.
The distance between j and k is the tree's diameter.
See proof
Problems
Last updated
Was this helpful?