Lazy Propagation
Range updates are stored on nodes and pushed to children only when needed.
Segment Tree: Add to a range and leave the tags pending
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.
Cost
- Best
- O(log n)
- Average
- O(log n)
- Worst
- O(log n)
- Space
- O(n)
Before this
Taught by the same lesson
Segment Tree covers these too, in the same run.