🌲 Fenwick Tree (BIT) Operations
USACO C++ Book · Interactive Visualizer
🌲 Fenwick Tree — Point Update & Prefix Query Demo
Fenwick Tree
O(log N) update / query
Step 0/12
📊 BIT Tree Structure
🗂 Data Structures
A[] Original Array (1-indexed)
tree[] BIT Array
Current Operation
Updated:
O(log N)
Query:
O(log N)
💻 Code
Hint
Click
Next Step ▶
to start. First observe BIT construction (which tree[i] manages which range), then see update(3, +5) propagation and query(7) decomposition.
◀ Prev
Next Step ▶
↺ Reset
0/12
Keyboard:
→
Next
←
Prev
R
Reset