Fenwick Tree
Fenwick Tree
Introduction
A Fenwick tree is a data structure that supports the following functions:
- Update the value of an element at position in .
- Maintain a prefix function: in obtain any prefix sum up to .
Algorithm

The main idea is somewhat similar to a segment tree. Exactly segments are created, in which we will store the sum of the elements of that segment. So that: