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

Function main

CPP/Fenwick Tree/fenwickTree.cpp:36–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36int main()
37{
38 int freq[] = {2, 1, 1, 3, 2, 3, 4, 5, 6, 7, 8, 9};
39 int n = sizeof(freq)/sizeof(freq[0]);
40 int *BITree = constructBITree(freq, n);
41 cout << "Sum of elements in arr[0..5] is " << getSum(BITree, 5);
42
43 freq[3] += 6;
44 updateBIT(BITree, n, 3, 6); //Update BIT for above change in arr[]
45
46 cout << "\nSum of elements in arr[0..5] after update is " << getSum(BITree, 5);
47
48 return 0;
49}

Callers

nothing calls this directly

Calls 3

constructBITreeFunction · 0.85
updateBITFunction · 0.85
getSumFunction · 0.70

Tested by

no test coverage detected