### heyyolol's blog

By heyyolol, history, 22 months ago,

Hi everyone, does (2D range add update, and range sum queries) fenwick and segment tree exist?

If there is could someone kindly provide me ur code? Thanks :)

I tried googling but I didn't find anything really useful. :( Edit: Like by range I mean for e.g. (a,b) to (c,d), for a<=c && b<=d.

• +2

 » 22 months ago, # | ← Rev. 2 →   +5 2-D Fenwick:
•  » » 22 months ago, # ^ |   +14 i = (i & (i + 1)) - 1 and i = (i | (i + 1))? Why not i -= i & -i and i += i & -i?
•  » » » 22 months ago, # ^ | ← Rev. 3 →   +5 i = (i & (i + 1)) - 1 and i = (i | (i + 1)) for 0-indexation; i -= i & -i and i += i & -i for 1-indexation
•  » » 22 months ago, # ^ |   0 hmm the inc part looks like point update to me? R u sure that's range update?? Like by range I mean for e.g. (a,b) to (c,d), for a<=c && b<=d.
•  » » » 22 months ago, # ^ |   0 is there range update on fenwick tree?
•  » » » » 22 months ago, # ^ |   +6 Yes, see here.