Heavy-Light Decomposition for Tree Operations

Heavy-Light Decomposition (HLD) is a powerful technique that partitions a rooted tree into a set of disjoint paths (chains). This transformation allows for efficient range-based operations (like updates and queries) on tree structures by mapping the nodes into a linear array using a Segment Tree. Core Definitions Heavy Edge: An edge connecting ...

Posted on Sun, 07 Jun 2026 17:42:18 +0000 by asunsha