Add Adds value to the element at position pos of the array and recomputes the range sums.
(pos int, value int)
| 54 | // Add Adds value to the element at position pos of the array |
| 55 | // and recomputes the range sums. |
| 56 | func (f *FenwickTree) Add(pos int, value int) { |
| 57 | for i := pos; i <= f.n; i += (i & -i) { |
| 58 | f.bit[i] += value |
| 59 | } |
| 60 | } |
no outgoing calls