Struct BalancedBinaryTree

Source
pub struct BalancedBinaryTree<K: Ord, M: Monoid> {
    pub root: Option<Box<NodeInner<K, M>>>,
    /* private fields */
}
Expand description

平衡2分木

  • 1点更新,区間取得
  • 遅延評価なし

Fields§

§root: Option<Box<NodeInner<K, M>>>

Implementations§

Source§

impl<K: Ord, M: Monoid> BalancedBinaryTree<K, M>

Source

pub fn get(&self, key: &K) -> &M::Val

1点取得(不変参照)

  • key を持つノードの不変参照を取得する
Source

pub fn get_mut(&mut self, key: K) -> NodeEntry<'_, K, M>

1点取得(可変参照)

  • key を持つノードの可変参照を取得する
Source

pub fn insert(&mut self, key: K, value: M::Val)

要素の更新

  • key:更新するキー
  • value:更新後の値
Source

pub fn remove(&mut self, key: &K) -> Option<M::Val>

要素の削除

  • key:削除するキー
Source

pub fn get_range<R: RangeBounds<K>>(&self, range: R) -> M::Val

区間の取得

  • 区間 range の要素を集約する
Source

pub fn len(&self) -> usize

要素数を取得

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl<K: Ord, M: Monoid> Default for BalancedBinaryTree<K, M>

Source§

fn default() -> Self

動的セグ木の初期化

Auto Trait Implementations§

§

impl<K, M> Freeze for BalancedBinaryTree<K, M>
where <M as Monoid>::Val: Freeze,

§

impl<K, M> RefUnwindSafe for BalancedBinaryTree<K, M>

§

impl<K, M> Send for BalancedBinaryTree<K, M>
where <M as Monoid>::Val: Send, K: Send,

§

impl<K, M> Sync for BalancedBinaryTree<K, M>
where <M as Monoid>::Val: Sync, K: Sync,

§

impl<K, M> Unpin for BalancedBinaryTree<K, M>
where <M as Monoid>::Val: Unpin,

§

impl<K, M> UnwindSafe for BalancedBinaryTree<K, M>
where <M as Monoid>::Val: UnwindSafe, K: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V