Concepts3
⚙️AlgorithmAdvanced
Sqrt Decomposition on Queries
Sqrt decomposition on queries (time blocking) processes Q operations in blocks of size about \(\sqrt{Q}\) to balance per-query overhead and rebuild cost.
#sqrt decomposition#time blocking#query blocking+12
⚙️AlgorithmAdvanced
DSU on Tree (Sack)
DSU on Tree (also called the Sack technique) answers many subtree queries in O(n \log n) by keeping data from the heavy child and temporarily re-adding light subtrees.
#dsu on tree#sack technique#subtree queries+12
⚙️AlgorithmAdvanced
Virtual Tree (Auxiliary Tree)
A Virtual Tree (Auxiliary Tree) compresses a large tree into a much smaller tree that contains only the k important nodes and the LCAs needed to keep them connected.
#virtual tree#auxiliary tree#lca+12