Concepts3
⚙️AlgorithmIntermediate
Offline Query Processing
Offline query processing means you collect all queries first and answer them later in a smart order that makes updates/queries cheap.
#offline query processing#mo's algorithm#fenwick tree+12
⚙️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