Loading page…
Prefix sums answer a range total in constant time, but one change rewrites many entries. A Fenwick tree answers sums with point changes by clearing and adding the lowest set bit. A segment tree stores halves, takes any combine rule, and with lazy propagation handles range updates. A sparse table gives instant minimums when nothing changes, because two overlapping blocks are safe for an idempotent rule. Choose by what changes and what the question asks.
You work on the dashboard of a small shop.