[][src]Struct chtholly::ChthollyTree

pub struct ChthollyTree(_);

Representation of Chtholly Tree. The nodes are sorted by their range.

Implementations

impl ChthollyTree[src]

pub fn from_slice(data: &[u64]) -> Self[src]

Generate a new Chtholly Tree from a slice.

pub fn split(&mut self, middle: usize) -> Option<&ChthollyNode>[src]

Split the range between [left, middle - 1] and [middle, right]. Returns the node representing [middle, right].

pub fn merge(&mut self, left: usize, right: usize, value: u64)[src]

Set all values between [left, right] to be value, and merge them. Split nodes when necessary. Create a new node if it does not yet exist.

pub fn add(&mut self, left: usize, right: usize, value: u64)[src]

Add x to all values between [left, right].

pub fn nth(&self, left: usize, right: usize, n: usize) -> Option<u64>[src]

Find n-th (0-indexed) smallest value after left.

pub fn pow_sum(&self, left: usize, right: usize, power: u32, modulo: u64) -> u64[src]

Compute the sum of power between [left, right].

Trait Implementations

impl Clone for ChthollyTree[src]

impl Debug for ChthollyTree[src]

impl Eq for ChthollyTree[src]

impl Hash for ChthollyTree[src]

impl PartialEq<ChthollyTree> for ChthollyTree[src]

impl StructuralEq for ChthollyTree[src]

impl StructuralPartialEq for ChthollyTree[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.