YUNOVA · Data Structures & Algorithms · Module 13: Advanced data structures
Fenwick tree (Binary Indexed Tree)
Fenwick tree (Binary Indexed Tree)
Key points
- A Fenwick tree supports prefix sums and point updates in O(log n).
- It moves through indices using i & -i, the lowest set bit.
- A range sum is prefix(r) - prefix(l - 1).