pub struct LazyPersistentSegmentTree<T: PersistentNode + LazyNode> { /* private fields */ }
Expand description

Lazy persistent segment tree, it saves every version of itself, it has range queries and range updates. It uses O(n+q*log(n)) space, where q is the amount of updates, and assuming that each node uses O(1) space.

Implementations

Builds a lazy persistent 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.

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

It will panic if p is not in [0,n), or if version is not in [0,versions). It has time complexity of O(log(n)), assuming that combine, update_lazy_value and update_lazy_value have constant time complexity.

Return the amount of different versions the current segment tree has.

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.