AI engineering glossary · Data structures algorithms
What is BIT (fenwick tree)?
Fenwick tree (also called binary indexed tree, BIT): A compact structure stored in a single array that supports prefix-sum queries and single-element updates in O(log n) time by using the binary representation of indices. It is simpler and lighter than a segment tree for sums.
Fenwick tree: an example
After adding a sale to day 37, the total of days 1 to 100 is recomputed with about seven array reads instead of 100.
Related terms
More Data structures algorithms terms
Where you learn it
Fenwick tree is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.