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.

HPD structureHeavy childbiggest subtreeChainsconsecutive heavyPath queryO(log²n) chains + segment treeAlternative: LCT for fully dynamic; HPD for static trees
HPD.
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.