Segment tree
Range queries in logarithmic time.
Bentley introduced segment trees in his thesis on computational geometry. Pre-aggregate the array at every power-of-two granularity; answer any range query as the union of O(log n) covering nodes. Generalises to any associative aggregate: sum, min, max, GCD, matrix multiplication.
A balanced binary tree where each leaf is one array element and each internal node holds the aggregate of its leaves' range. Range query walks two pointers up the tree picking off the largest fully-contained nodes. Lazy propagation extends it to range updates in O(log n) amortised.
Editor minimum-indentation queries. Database query-optimiser cost arithmetic. Time-series percentile rollups. Every "competitive programming" interview round above easy.
A segment tree handles any associative aggregate; a Fenwick tree (BIT) is faster but only handles invertible ones (sum, XOR). Pick segment for min/max/GCD; pick Fenwick for sum.