Struct competitive_programming_rs::data_structure::fenwick_tree::FenwickTree
[−]
[src]
pub struct FenwickTree { /* fields omitted */ }
FenwickTree
is a data structure that can efficiently update elements
and calculate prefix sums in a table of numbers.
https://en.wikipedia.org/wiki/Fenwick_tree
Methods
impl FenwickTree
[src][−]
pub fn new(size: usize) -> FenwickTree
[src][−]
Constructs a new FenwickTree
. The size of FenwickTree
should be specified by size
.
pub fn sum(&self, l: usize, r: usize) -> usize
[src][−]
Returns a sum of range [l, r)
pub fn sum_one(&self, k: usize) -> usize
[src][−]
Returns a sum of range [0, k)