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

動的セグメント木

  • 平行2分木(AA木)
  • 遅延評価なし

Fields§

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

Implementations§

source§

impl<K: Ord, M: Monoid> DynamicSegmentTree<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

source§

impl<K, M> DynamicSegmentTree<K, M>where K: Ord + Debug, M: Monoid, M::Val: Debug,

source

pub fn print_as_binary_tree(&self)

2分木として出力する

Trait Implementations§

source§

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

source§

fn default() -> Self

動的セグ木の初期化

Auto Trait Implementations§

§

impl<K, M> RefUnwindSafe for DynamicSegmentTree<K, M>where K: RefUnwindSafe, <M as Monoid>::Val: RefUnwindSafe,

§

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

§

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

§

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

§

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

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V