class FenwickTree(T)

Defined in:

datastructure/fenwick_tree.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(array : Array(T)) #

[View source]
def self.new(size : Int) #

[View source]

Instance Method Detail

def [](start : Int, count : Int) : T #

Returns sum of a[start, count]


[View source]
def [](index : Int) #

Returns index th element.


[View source]
def [](range : Range) : T #

Returns sum of a[range]


[View source]
def []=(index : Int, x) : Nil #

Set x to index th element.


[View source]
def add(index : Int, x) : Nil #

Adds x to index th element.


[View source]
def left_sum(i : Int) : T #

Culculates sum of a[0...i].


[View source]
def set(index : Int, x) : Nil #

Set x to index th element.


[View source]
def size : Int32 #

[View source]
def to_a : Array(T) #

Returns the elements as an Array.


[View source]