fenwick tree class
More...
#include <fenwick_tree.h>
|
| fenwick_tree (const std::vector< T > &v) noexcept |
| default constructor of fenwick tree class
|
|
T | sum (int k) |
| sum query function
|
|
T | sum (int a, int b) |
| sum query function(from index a to b)
|
|
void | update (int k, int x) |
| update query function
|
|
|
std::vector< T > | tree |
|
int | n |
|
template<typename T>
struct fenwick_tree< T >
fenwick tree class
◆ fenwick_tree()
default constructor of fenwick tree class
- Parameters
-
◆ sum() [1/2]
sum query function(from index a to b)
- Parameters
-
a | starting index |
b | ending index |
- Returns
- T: the sum of range [a, b]
◆ sum() [2/2]
sum query function
- Parameters
-
k | the ending index of the query |
- Returns
- T: the sum of range [0, k]
◆ update()
update query function
- Parameters
-
k | the index |
x | the value that will be added to data[k] |
The documentation for this struct was generated from the following file: