Why it matters
HPD enables efficient tree path queries. Standard for advanced tree problems.
Advertisement
The architecture
Heavy child: subtree of half+.
Chain: consecutive heavy edges.
Advertisement
How it works end to end
Path query: at most O(log n) chains crossed.
Segment tree per chain or flattened.
Static trees: efficient. Dynamic: use LCT.