Fenwick Trees (Binary Indexed Trees)
The same O(log n) range-sum-with-updates power as a segment tree, in about ten lines, once you learn one bit trick.
9 min readUpdated 2026-09-03fenwick-treebinary-indexed-treebit-manipulation
The same O(log n) range-sum-with-updates power as a segment tree, in about ten lines, once you learn one bit trick.