AlgoScope

Lazy Propagation

AlgorithmadvancedRange Queries

Range updates are stored on nodes and pushed to children only when needed.

Decision · step 2 of 15Segment Tree: Add to a range and leave the tags pending
58316781364106202108current

This node covers indices 0 to 7. The range covers only part of it, so any tag here is pushed down and both children are visited.

Open in the player →or start at step 2

What you will see

A pending update badge sits on a node until a query or update descends through it.

How segment tree works →

Cost

BestO(log n)
AverageO(log n)
WorstO(log n)
SpaceO(n)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.

Screen readers: Structure nodes announce the range they cover and their value; each step announces which nodes answer the query.

Reduced motion: Contributing nodes highlight statically; no path animation.

Taught by the same lesson

Segment Tree covers these too, in the same run.