Let us consider the following problem to understand Binary Indexed Tree.
We have an array arr[0 . . . n-1]. We would like to
1 Compute the sum of the first i elements.
2 Modify the value of a specified element of the array arr[i] = x where 0 <= i <= n-1.
A simple solution is to run a loop from 0 to i-1 and calculate the sum of the elements. To update a value, simply do arr[i] = x.
Binary Indexed Tree or Fenwick Tree _ Construction and Operations: https://www.geeksforgeeks.org/binary-indexed-tree-or-fenwick-tree-2/