Struct bio::data_structures::bit_tree::FenwickTree
source · [−]Expand description
In a max bit tree or Fenwick Tree, get(i) will return the largest element e that has been added
to the bit tree with set(j, e), where j <= i. Initially all positions have
the value T::default(). Note that a set cannot be ‘undone’ by inserting
a smaller element at the same index.
Time Complexity: O(n) to build a new tree or O(log n) for get() and set() operations,
where n = tree.len()
.
Implementations
sourceimpl<T: Ord + Default + Copy, Op: PrefixOp<T>> FenwickTree<T, Op>
impl<T: Ord + Default + Copy, Op: PrefixOp<T>> FenwickTree<T, Op>
Auto Trait Implementations
impl<T, Op> RefUnwindSafe for FenwickTree<T, Op> where
Op: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, Op> Send for FenwickTree<T, Op> where
Op: Send,
T: Send,
impl<T, Op> Sync for FenwickTree<T, Op> where
Op: Sync,
T: Sync,
impl<T, Op> Unpin for FenwickTree<T, Op> where
Op: Unpin,
T: Unpin,
impl<T, Op> UnwindSafe for FenwickTree<T, Op> where
Op: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.