We have an array arr[0 . . . n-1]
. We should be able to
- Find the sum of elements from index L to R where 0 <= L <= R <= n-1 .
- Change value of a specified element of the array
arr[i] = x
where 0 <= i <= n-1.
This can be solved using segment tree efficiently .
But how to solve opposite to this i.e.
- Find the sum of all elements (arr[i]) from index 0 to n-1 excluding L<= i <= R where L and R are given.
- Change value of a specified element of the
array arr[i] = x
where 0 <= i <= n-1.
How to solve above question efficiently like segment tree?