Fenwick Tree
A Fenwick tree, or binary indexed tree, stores partial prefix sums. Adding a value and reading a prefix both follow the binary representation of the index.
Costs
| Category | Data Structure |
| Difficulty | Hard |
| Point update | O(log n) |
| Prefix sum | O(log n) |
| Build from an array | O(n log n), or O(n) with a careful fill |
Questions
What is Fenwick Tree?
A Fenwick tree, or binary indexed tree, stores partial prefix sums. Adding a value and reading a prefix both follow the binary representation of the index.
Where do I practice it?
DSA Master keeps challenges and progress on the phone. This page is the idea and the costs.