summaryrefslogtreecommitdiff
path: root/datastructures
diff options
context:
space:
mode:
Diffstat (limited to 'datastructures')
-rw-r--r--datastructures/fenwickTree.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/datastructures/fenwickTree.cpp b/datastructures/fenwickTree.cpp
index bb3f72d..3b54fc9 100644
--- a/datastructures/fenwickTree.cpp
+++ b/datastructures/fenwickTree.cpp
@@ -1,8 +1,9 @@
vector<int> FT; //Fenwick-Tree
+int n;
//Build an Fenwick-Tree over an array a. Time Complexity: O(n*log(n))
void buildFenwickTree(vector<int>& a) {
- int n = a.size();
+ n = a.size();
FT.assign(n+1,0);
for(int i = 0; i < n; i++) updateFT(i,a[i]);
}