Range Update in BIT

Is it possible to update a range in Binary Indexed Tree…??
I want this to solve the http://www.codechef.com/problems/FLIPCOIN problem using Binary Indexed Tree(BIT).

1 Like


I’ve explained range updates with BIT and provided implementation here:


Really amazing post!! :smiley: It helped me understanding some things in a pratical way which I’ve only read about! Thanks!

another goes here…

hey …did studied ur post bt could not understand “Why we are not doing :- update(a,v) update(b+1,-v) for the update part and query(b)-query(a-1) for the sum part …whats wrong in that part???”

I have spent many days to understand range update, wrote simple explanation with example here: