← Back

Fenwick Tree (Binary Indexed Tree)

Prefix sums & updates in O(log n) using bit manipulation.

treesfenwickbitUpdated 2025-09-01

Operations

  • Update: i+=i&-i
  • Query: i-=i&-i

Space

  • O(n)