Sunday, 15 September 2013

algorithm - Adding a Geometric Progression (GP) on any segment of an array using Segment Trees -



algorithm - Adding a Geometric Progression (GP) on any segment of an array using Segment Trees -

i know how create range update on segment tree involving add-on of constant or add-on of ap given segment of array lazy propagation , making subsequent queries sum of given segment cannot apply same thought geometric progressions.

how can achieved using segment trees in same asymptotic time complexity (log(n))?

for illustration if array : a[1], a[2], .... , a[l],a[l+1]...a[r-1], a[r] ... a[n - 1], a[n] , if update [l, r] mutual ratio of d updated array a[1], a[2], .... , a[l] + d, a[l+1] + d^2 ...a[r-1] + d^(l-r), a[r] + d^(l-r+1) ... a[n - 1], a[n]

and 1 should still able create queries sum of segment in log(n).

arrays algorithm data-structures segment fenwick-tree

No comments:

Post a Comment