Struct comlib_range::Bit [−][src]
pub struct Bit<T>(_);Expand description
Binary indexed tree.
Binary indexed tree, also known as Fenwick tree, is a data structure that allows effectively updating a single value and querying the sum of values over a range.
Note that unlike most binary indexed tree implementations, this implementation uses 0-indexing instead of 1-indexing.
Time complexity
All operations on binary indexed tree take O(log n) time, unless otherwise stated.
Implementations
Computes the sum of values on the given range.
Increases the value at the given index by the given value.
Trait Implementations
Debug on Bit prints the original values of the array, not the values in the nodes of the tree.
Time complexity
Printing takes O(n log n) time.
Constructs binary indexed tree from the given Vec.
Time complexity
Construction takes O(n log n) time.
Auto Trait Implementations
impl<T> RefUnwindSafe for Bit<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Bit<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more