AlgoScope

Fenwick Update and Query

AlgorithmadvancedRange Queries

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
active 7-70315253114451062✓7308i

Cell 7 covers 7 to 7 and holds 2. Add it: sum 2. Then jump to 7 - 1 = 6.

Open in the player →or start at step 2

What you will see

The visited indices light up with their binary forms; the lowest set bit is shown being cleared or added.

How fenwick tree works →

Cost

BestO(log n)
AverageO(log n)
WorstO(log n)
SpaceO(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.

Before this

Taught by the same lesson

Fenwick Tree covers these too, in the same run.