- i. Sparse Table: queries on a static array after preprocessing.
- ii. Range Minimum Query: RMQ on a static array is equivalent to LCA on a tree:
- iii. Fenwick Tree: A Fenwick tree (binary indexed tree) stores partial sums over power-of-two blocks:
- iv. Segment Tree: A segment tree stores an associative aggregate for each of the canonical segments.
- v. Lazy Propagation: Range updates in :
- vi. Dynamic and Persistent Segment Trees: struct DynSeg {
- vii. Segment Tree Beats and Historic Values: Some updates can’t be applied to a whole node in :
- viii. Li Chao and Kinetic Segment Trees: Both maintain sets of lines and answer “best value at ”.
- ix. Segment Tree Merging and Splitting: Many dynamic segment trees over the same value range share one node pool.
- x. Range Order Statistics and Wavelets: Queries like “-th smallest in ”, “how many values in lie in ”, predecessor/successor within a range.
- xi. Sqrt Decomposition: Split something (the array, the values, the time line, the set of objects) into -sized pieces so that two different costs balance.
- xii. Mo’s Algorithm: Offline range queries where the window can be extended and shrunk by one element in (or ):
- xiii. Offline and 2D Range Queries: Most “2D” problems (points in rectangles, range queries with a value condition, distinct values in a range) become 1D after sorting by one coordinate and sweeping with a Fenwick tree over the other.
- xiv. Permutation Tree: For a permutation , call a subarray an interval if its values form a contiguous range, i.e.
- xv. Range LIS: Answer “length of the longest strictly increasing subsequence of ” for many ranges.