diff options
Diffstat (limited to 'datastructures/fenwickTree.cpp')
| -rw-r--r-- | datastructures/fenwickTree.cpp | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/datastructures/fenwickTree.cpp b/datastructures/fenwickTree.cpp deleted file mode 100644 index cac3cf8..0000000 --- a/datastructures/fenwickTree.cpp +++ /dev/null @@ -1,15 +0,0 @@ -vector<ll> tree; - -void update(int i, ll val) { - for (i++; i < sz(tree); i += (i & (-i))) tree[i] += val; -} - -void init(int n) { - tree.assign(n + 1,0); -} - -ll prefix_sum(int i) { - ll sum = 0; - for (i++; i > 0; i -= (i & (-i))) sum += tree[i]; - return sum; -} |
