arrayscomplexity
When are prefix sums worth using?
Anonymous
for many range-sum queries on an array that doesn't change, build a prefix-sum array once. A range sum then takes O(1) time by subtracting two prefix values. If values change often, the saved query work has to be weighed against updating the structure.
0