Concepts4
⚙️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
Parallel Binary Search
Parallel Binary Search (PBS) lets you binary-search the answers of many queries at once by batching them by their current mid value.
#parallel binary search#offline queries#monotone predicate+10
⚙️AlgorithmAdvanced
CDQ Divide and Conquer
CDQ divide and conquer is an offline technique that splits the timeline (or one coordinate) and lets updates from the left half contribute to queries in the right half.
#cdq divide and conquer#offline algorithm#fenwick tree+11
⚙️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