Fenwick Tree: Rails, Cells and the Cost of Each Operation (2D)
The same machine as a flat diagram: the cell row with values, the Fenwick rails above it with the visited nodes coloured, the running sums written out, and a bar chart of the cost of each operation on a plain array, a prefix-sum array and the Fenwick tree.
A table of amber blocks carries a Fenwick tree as teal rails stacked above it: rail i covers the lowbit(i) cells ending at i. A machine performs point updates and range-sum queries one after another while a red pointer walks the nodes. Updates climb by adding the lowest set bit, queries descend by clearing it, and both stay within floor(log2 n) + 1 nodes. Change the array length, the number of operations, the share of queries and the build method, compare the cost with a plain array and a prefix-sum array, and verify seven independent numerical checks against brute force and closed forms.
The same machine as a flat diagram: the cell row with values, the Fenwick rails above it with the visited nodes coloured, the running sums written out, and a bar chart of the cost of each operation on a plain array, a prefix-sum array and the Fenwick tree.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install