Fenwick Update and Query
Query walks i to i minus lowbit(i). Update walks i to i plus lowbit(i).
Decision · step 2 of 5Fenwick Tree: Sum of the first 7
Cell 7 covers 7 to 7 and holds 2. Add it: sum 2. Then jump to 7 - 1 = 6.
What you will see
The visited indices light up with their binary forms; the lowest set bit is shown being cleared or added.
Cost
| Best | O(log n) |
|---|---|
| Average | O(log n) |
| Worst | O(log n) |
| Space | O(n) |
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.
Screen readers: Structure nodes announce the range they cover and their value; each step announces which nodes answer the query.
Reduced motion: Contributing nodes highlight statically; no path animation.