Segment tree

Replace one number and find the sum or minimum over a chosen interval.

Each cell owns an interval. Two adjacent child intervals make up their parent’s interval.

Choose whole blocks that cover the query interval without gaps or overlaps.

Construction takes O(n) time and space. Point updates and interval queries take O(log n).