pub struct SegmentTree<T: Node + Clone> { /* private fields */ }
Expand description

Segment tree with range queries and point updates. It uses O(n) space, assuming that each node uses O(1) space.

Implementations

Builds segment tree from slice, each element of the slice will correspond to a leaf of the segment tree. It has time complexity of O(n*log(n)), assuming that combine has constant time complexity.

Sets the i-th element of the segment tree to value T and update the segment tree correspondingly. It will panic if i is not in [0,n) It has time complexity of O(log(n)), assuming that combine has constant time complexity.

Returns the result from the range [left,right]. It returns None if and only if range is empty. It will panic if left or right are not in [0,n). It has time complexity of O(log(n)), assuming that combine has constant time complexity.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.