Fenwick Tree Visualizer
Build a Binary Indexed Tree, inspect each one-based coverage range, run prefix-sum jumps, and preview point updates.
Fenwick input
The input is zero-based. Fenwick tree slots are shown one-based.
Range query
Point update
Step controls
Step 1 of 6: Start range sum query [2, 6] as prefix(6) - prefix(1).
Fenwick tree slots
Start range sum query [2, 6] as prefix(6) - prefix(1).
Array view
Query summary
Trace
What is a Fenwick Tree Visualizer?
A Fenwick tree visualizer shows how a Binary Indexed Tree stores partial sums in a compact array.
This tool builds the tree array from your input values, shows the range covered by each Fenwick index, and traces prefix sums using index -= lowbit(index). It also previews point updates using index += lowbit(index).
For the full cluster of related pages, browse the Data Structure Visualizers hub.
How to use this Fenwick tree visualizer
- Paste an array of whole numbers.
- Choose a left and right index for a range sum query.
- Run the query to see
prefix(right) - prefix(left - 1). - Choose an index and new value to preview the point update path.
- Compare each Fenwick tree slot with the original array range it covers.
Fenwick tree vs segment tree
A Fenwick tree is smaller and often simpler than a segment tree for prefix sums and point updates. It stores sums in one array and uses the least significant set bit to decide which ranges are covered.
Use the Segment Tree Visualizer when you want to compare this compact structure with a tree-shaped range-query structure.
For static range minimum and maximum queries, use the Sparse Table Visualizer.