Codex Wiki
OurBigBook.com
Site
Source code
Prefix sum
(
P
m
=
∑
i
=
1
m
a
i
)
Home
Mathematics
Area of mathematics
Arithmetic
Addition
Sum
OurBigBook.com
Words: 30
The prefix sums
P
m
=
∑
i
=
1
m
a
i
can all be computed by the recurrence
P
m
=
P
m
−
1
+
a
m
in linear time. Any contiguous sum is then
P
b
−
P
a
−
1
, so it takes constant time after preprocessing.
Ancestors
(6)
Sum
Addition
Arithmetic
Area of mathematics
Mathematics
Home
Incoming links
(1)
Solution