For values [2,5,1,4], a sum query over indices 1 through 3 combines the intervals covering 5, 1, and 4.
Read the related guide · · Bookmark this unique URL with Ctrl/Cmd+D.
A segment tree stores summaries over intervals, combining child intervals to answer range queries and point updates. Experiment with a small example and see each step update.
For values [2,5,1,4], a sum query over indices 1 through 3 combines the intervals covering 5, 1, and 4.
Read the related guide · · Bookmark this unique URL with Ctrl/Cmd+D.