Nu exista diferente intre titluri.
Diferente intre continut:
h2. Range Sum
Given an n elements array, implement a data structure for point updates and range sum queries:
bq.. Given an n elements array, implement a data structure for point updates and range sum queries:
- set(i, x): a[i] := k,
- sum(lo, hi) returns a[lo] + a[lo+1] + .. + a[hi].
The naive solution uses an array. It takes <tex>O(1)</tex> time for an update and <tex>O(r-l) \eq O(n)</tex> for the range sum.
p. The naive solution uses an array. It takes <tex>O(1)</tex> time for an update and <tex>O(r-l) \eq O(n)</tex> for the range sum.
A more efficient solution splits the array into length k slices and stores the slice sums in an array S.
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.