MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / Add

Method Add

structure/fenwicktree/fenwicktree.go:56–60  ·  view source on GitHub ↗

Add Adds value to the element at position pos of the array and recomputes the range sums.

(pos int, value int)

Source from the content-addressed store, hash-verified

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

Callers 1

TestFenwickTreeFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestFenwickTreeFunction · 0.76