Fenwick tree

Basic idea

Binary-indexed tree: an array that supports prefix-sum queries and point updates in O(logn)O(\log n) using bit tricks on the index. Smaller and faster constants than a segment tree when only prefix sums are needed.

Key formulas

Resources

Siblings