powered by
Methods:
new(init) Initializes from a vector init.
new(init)
update(location, new.val) Replaces the item at location with new.val.
update(location, new.val)
query(l, r) Returns the sum of the interval [l, r].
query(l, r)
show.BIT () Returns the Binary Indexed Tree.
show.BIT ()
show.origin() Returns the vector.
show.origin()
BinaryIndexedTree
An object of class R6ClassGenerator of length 24.
R6ClassGenerator
# NOT RUN { tmp <- BinaryIndexedTree$new(c(2,3,2,5,1)) tmp$update(1,3) tmp$query(1,5) tmp$show.origin() tmp$show.BIT() # }
Run the code above in your browser using DataLab