Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 48s1 days 16 hours 1 minutes 48 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 48s1 days 16 hours 1 minutes 48 seconds.

Sign in to watch this lesson
Advanced - Data Structures and Range Queries · 4:00
When positions run up to 10^9 but only a few are ever used, a dynamic segment tree keeps the full tree only in principle: the root exists, and an update creates the missing nodes on its root-to-leaf path, about 30 of them. Reads treat a missing child as zero and must never allocate. Nodes live in an index pool, the midpoint is computed as l + (r - l) / 2, lazy notes work as usual, and when all queries are known in advance, coordinate compression with an ordinary tree is simpler and faster.