diff options
| author | Paul Jungeblut <paul.jungeblut@gmail.com> | 2016-06-27 14:20:11 +0200 |
|---|---|---|
| committer | Paul Jungeblut <paul.jungeblut@gmail.com> | 2016-06-27 14:20:11 +0200 |
| commit | e23c72d59605de49b6090483c633788be8300ac3 (patch) | |
| tree | e303da091590979f7aec745e5e69d9ea271dcbd6 /datastructures/fenwickTree.cpp | |
| parent | df13ed5e437b3d75394ba704e9d3eb2c29d037b2 (diff) | |
More changes in fenwick implementation.
Diffstat (limited to 'datastructures/fenwickTree.cpp')
| -rw-r--r-- | datastructures/fenwickTree.cpp | 3 |
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]); } |
