Concepts3
⚙️AlgorithmIntermediate
Lowest Common Ancestor (LCA)
The Lowest Common Ancestor (LCA) of two nodes in a rooted tree is the deepest node that is an ancestor of both.
#lowest common ancestor#binary lifting#euler tour+12
🗂️Data StructureAdvanced
HLD - Path Queries and Updates
Heavy-Light Decomposition (HLD) breaks a tree into a small number of vertical chains so any path (u,v) becomes O(log n) contiguous segments in an array.
#heavy light decomposition#hld#path query+12
🗂️Data StructureAdvanced
Heavy-Light Decomposition
Heavy-Light Decomposition (HLD) breaks a tree into O(n) disjoint chains so that any root-to-node path crosses only O(log n) chains.
#heavy light decomposition#hld c++#segment tree on tree+10