Heavy-Light Decomposition (HLD) Interactive Visualizer
Heavy-Light Decomposition splits a rooted tree into disjoint heavy chains so any path between two nodes crosses at most O(log n) chains, reducing tree path queries and updates to Segment Tree operations in O(log^2 n).
Study Heavy-Light Decomposition (HLD) Explanation · View Multi-Language Code · All Algorithms