pub struct Iterative<T> { /* private fields */ }
Expand description
Segment tree with range queries and point updates.
It uses O(n)
space, assuming that each node uses O(1)
space.
Note if you need to use lower_bound
, just use the RecursiveSegmentTree
it uses double the memory though and it’s less performant.
Implementations§
Source§impl<T> Iterative<T>
impl<T> Iterative<T>
Sourcepub fn build(values: &[T]) -> Self
pub fn build(values: &[T]) -> Self
Builds segment tree from slice, each element of the slice will correspond to a leaf of the segment tree.
It has time complexity of O(n*log(n))
, assuming that combine has constant time complexity.
Auto Trait Implementations§
impl<T> Freeze for Iterative<T>
impl<T> RefUnwindSafe for Iterative<T>where
T: RefUnwindSafe,
impl<T> Send for Iterative<T>where
T: Send,
impl<T> Sync for Iterative<T>where
T: Sync,
impl<T> Unpin for Iterative<T>where
T: Unpin,
impl<T> UnwindSafe for Iterative<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more