NgLib::CompressedWaveletMatrix(T)
Inherits Indexable < Enumerable < Iterable < Reference < Object
Constructors
Instance methods
range の表す区間に含まれる要素の中で bound が表す範囲の値の個数を返します。
range の表す区間に含まれる要素のうち、kth 番目に大きい値を返します。
wm = WaveletMatrix.new([1, 3, 2, 5])
wm.kth_largest(1..2, 0) # => 3
wm.kth_largest(1..2, 1) # => 2
kth 番目に大きい値を返します。
wm = WaveletMatrix.new([1, 3, 2, 5])
wm.kth_smallest(0) # => 5
wm.kth_smallest(1) # => 3
wm.kth_smallest(2) # => 2
wm.kth_smallest(3) # => 1
range の表す区間に含まれる要素のうち、kth 番目に小さい値を返します。
wm = WaveletMatrix.new([1, 3, 2, 5])
wm.kth_smallest(1..2, 0) # => 2
wm.kth_smallest(1..2, 1) # => 3
kth 番目に小さい値を返します。
wm = WaveletMatrix.new([1, 3, 2, 5])
wm.kth_smallest(0) # => 1
wm.kth_smallest(1) # => 2
wm.kth_smallest(2) # => 3
wm.kth_smallest(3) # => 5
range の表す区間に含まれる要素のうち、lower_bound 以上 の値の最小値を返します。
存在しない場合は nil を返します。
range の表す区間に含まれる要素のうち、upper_bound 未満 の値の最大値を返します。
存在しない場合は nil を返します。
Returns the element at the given index, without doing any bounds check.
Indexable makes sure to invoke this method with index in 0...size,
so converting negative indices to positive ones is not needed here.
Clients never invoke this method directly. Instead, they access
elements with #[](index) and #[]?(index).
This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.