ck/fenwick▲toc

Fenwick tree

.

type fenwickck/fenwick/fenwick: H -> V<h>

Add a value to an element. The first element is at position 1 (1-based). Raise an exception if index <= 0 or index > f.sizeck/fenwick/size: forall<h> (f : fenwick<h>) -> (read<h>) int.

Return the sum from the first element to the end-th element (inclusive). The first element is at position 1 (1-based). For convenience, return 0 if end = 0. Raise an exception if end < 0 or end > f.sizeck/fenwick/size: forall<h> (f : fenwick<h>) -> (read<h>) int.

private import std/core/typesstd/core/types, std/core/hndstd/core/hnd, std/corestd/core, std/num/int64std/num/int64