MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / getSum

Function getSum

CPP/Fenwick Tree/fenwickTree.cpp:4–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3
4int getSum(int BITree[], int index)
5{
6 int sum = 0;
7 index = index + 1;
8 while (index>0)
9 {
10 sum += BITree[index];
11 index -= index & (-index);
12 }
13 return sum;
14}
15
16void updateBIT(int BITree[], int n, int index, int val)
17{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected