[][src]Struct sfcpl::structure::fenwick_tree::FenwickTree

pub struct FenwickTree<T: Add> { /* fields omitted */ }

更新、区間和の取得がともにO(log n)で 可能なデータ構造

Implementations

impl<T: Add + Sub<Output = T> + Zero + Clone + Ord + Into<usize>> FenwickTree<T>[src]

pub fn new(n: usize) -> Self[src]

サイズを指定して、zerosで初期化

pub fn from(vec: &[T]) -> Self[src]

配列から構築

pub fn len(&self) -> usize[src]

扱える要素の最大値

pub fn add(&mut self, i: usize, v: T)[src]

更新

i番目の要素 += v

O(log n)

pub fn sum(&self, i: usize) -> T[src]

[0..i)の区間和

O(log n)

pub fn partial_sum(&self, a: usize, b: usize) -> T[src]

[a..b)の区間和

O(log n)

Trait Implementations

impl<T: Clone + Add> Clone for FenwickTree<T>[src]

impl<T: Debug + Add> Debug for FenwickTree<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for FenwickTree<T> where
    T: RefUnwindSafe

impl<T> Send for FenwickTree<T> where
    T: Send

impl<T> Sync for FenwickTree<T> where
    T: Sync

impl<T> Unpin for FenwickTree<T> where
    T: Unpin

impl<T> UnwindSafe for FenwickTree<T> where
    T: UnwindSafe

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> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,