src/cplib/collections/dualsegtree

  Source   Edit

Types

DualSegmentTree[S; F] = ref object
  data: seq[S]
  lazy: seq[F]
  mapping: proc (f: F; x: S): S
  composition: proc (f, g: F): F
  id: F
  lastnode: int
  log: int
  length: int
  Source   Edit

Procs

proc `$`[S, F](self: DualSegmentTree[S, F]): string
全要素を空白区切りの文字列として返します。   Source   Edit
proc `[]=`[S, F](self: DualSegmentTree[S, F]; index: Natural; value: S)
indexの値をvalueに置き換えます。   Source   Edit
proc `[]`[S, F](self: DualSegmentTree[S, F]; index: BackwardsIndex): S
後ろから数えたindexの現在値を返します。   Source   Edit
proc `[]`[S, F](self: DualSegmentTree[S, F]; index: int): S
indexの現在値を返します。   Source   Edit
proc apply[S, F](self: DualSegmentTree[S, F]; left, right: int; f: F)
半開区間[left, right)の各要素にfを作用させます。   Source   Edit
proc apply[S, F](self: DualSegmentTree[S, F]; segment: HSlice[int, int]; f: F)
閉区間segmentの各要素にfを作用させます。   Source   Edit
proc get[S, F](self: DualSegmentTree[S, F]; index: int): S
indexの現在値を返します。   Source   Edit
proc initDualSegmentTree[S, F](n: int; initValue: S;
                               mapping: proc (f: F; x: S): S;
                               composition: proc (f, g: F): F; id: F): DualSegmentTree[
    S, F]
initValueで初期化した長さnの双対セグメント木を生成します。   Source   Edit
proc initDualSegmentTree[S, F](v: openArray[S]; mapping: proc (f: F; x: S): S;
                               composition: proc (f, g: F): F; id: F): DualSegmentTree[
    S, F]
vを初期値として双対セグメント木を生成します。   Source   Edit
proc len[S, F](self: DualSegmentTree[S, F]): int
要素数を返します。   Source   Edit
proc toSeq[S, F](self: DualSegmentTree[S, F]): seq[S]
全要素をseqとして返します。   Source   Edit
proc update[S, F](self: DualSegmentTree[S, F]; index: Natural; value: S)
indexの値をvalueに置き換えます。   Source   Edit

Iterators

iterator items[S, F](self: DualSegmentTree[S, F]): S
  Source   Edit

Templates

template newDualSegWith(n, initValue, mapping, composition, id: untyped): untyped
  Source   Edit
template newDualSegWith(v, mapping, composition, id: untyped): untyped
  Source   Edit