Std.FenwickTree
11 public declarations
- add
&Std.FenwickTree.FenwickTree -> Int -> Int -> Option[Std.FenwickTree.FenwickTree]Adds `delta` to the 1-based element at `index` in O(log n) time.
- create
Int -> Std.FenwickTree.FenwickTreeAllocates a zero-initialized Fenwick tree for sequence length `elementCount`.
- FenwickTree
A low-level Binary Indexed Tree for O(log n) prefix sums and point updates.
- findPrefix
&Std.FenwickTree.FenwickTree -> Int -> Option[Int]Finds the smallest 1-based index whose prefix sum is >= `targetSum` in O(log n) time.
- fromArray
&Array[Int] -> Std.FenwickTree.FenwickTreeBuilds a Fenwick tree in strict O(n) linear time from an array of initial values.
- get
&Std.FenwickTree.FenwickTree -> Int -> Option[Int]Retrieves the single value at 1-based `index` in O(log n) time.
- prefixSum
&Std.FenwickTree.FenwickTree -> Int -> Option[Int]Computes the prefix sum up to 1-based `index` in O(log n) time.
- rangeSum
&Std.FenwickTree.FenwickTree -> Int -> Int -> Option[Int]Computes the range sum [left, right] inclusive in O(log n) time.
- set
&Std.FenwickTree.FenwickTree -> Int -> Int -> Option[Std.FenwickTree.FenwickTree]Sets the 1-based element at `index` to `value`.
- size
&Std.FenwickTree.FenwickTree -> IntReturns the number of elements in the tree.
- toArray
&Std.FenwickTree.FenwickTree -> Array[Int]Materializes the tree values into a standard 0-indexed array.
