Segment tree
hardEvery node owns a range; any query decomposes into at most 2 log n precomputed pieces. Three cases - no overlap, total overlap, partial - and only the third recurses.
Worst
O(log n) query and updateSpace O(4n)Loading the segment tree engine…