SegmentTree class
A segment tree over num supporting point updates and range queries.
Constructors
-
SegmentTree.max(List<
num> values) -
Builds a max tree: range queries return the maximum over the range.
The identity is
double.negativeInfinityfor the symmetric reason. Audited: 2026-06-12 11:26 EDT -
SegmentTree.min(List<
num> values) -
Builds a min tree: range queries return the minimum over the range.
The identity is
double.infinityso an empty merge never lowers a result. Audited: 2026-06-12 11:26 EDT -
SegmentTree.sum(List<
num> values) - Builds a sum tree: range queries return the sum over the range. Audited: 2026-06-12 11:26 EDT
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
query(
int low, int high) → num -
Combined value over the inclusive range
[low..high], inO(log n). Requires0 <= low <= high < length. -
toString(
) → String -
A string representation of this object.
override
-
update(
int index, num value) → void -
Sets the element at
index(0-based) tovalue, inO(log n). Requires0 <= index < length. -
valueAt(
int index) → num -
The current value at
index(0-based). Requires0 <= index < length. Audited: 2026-06-12 11:26 EDT
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited