Segment Tree
Segment Tree
Use Case 1: Range Minimum Query
Given a fixed-length array arr
and multiple interval queries [l, r]
, return the minimum number in the range [l, r]
.
Use Case 2: Range Sum
Given a fixed-length array arr
and multiple interval queries [l, r]
, return the sum of the numbers in the range [l, r]
.
References
This post is licensed under CC BY 4.0 by the author.