Given a sequence of static values of length N, a data structure where the preprocessing O(NlogN) allows operations on the upper interval of the sequence to be computed in O(1)
The operations that can be used are concrete, such as min, argmin is also acceptable - crossing half a bundle (e.g. of swords) - associative law : $(a * b) * c = a * (b * c)$ - commutative law : $a * b = b * a$ - power : $a * a = a$
Construction O(N log N)
query
Use segment tree when columns are updated - Sparse Tables and Segment Trees
For finding the least common ancestor of a tree by Euler Tour +Range Minimum Query.
Sparse-Table | Luzhiled's memo
Can be extended to two dimensions
This page is auto-translated from [/nishio/Sparse Table](https://scrapbox.io/nishio/Sparse Table) using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.