Hey, some problems that requires cumulative frequencies asks for range update and range queries.
This problem in it's simplest form can be solved using segment tree with lazy propagation.
It can also be solved using binary indexed tree, but using it here differs from using it with range update and point query, or point update and range query.
Now I read couple of articales about it, but they all give a breef explanation about direct solution only, that two BITs needed.
I still can't understand why this problem occers and how was this solution invented.
Can someone please explain this topic.
Thanks :D
Edit: This is a link to one of the explanations for this problem.
I don't know how helpful it will be, but check this out http://coutcode.com/blog/binaryindexedtree/
Edit: Well, if I shared it, why not ask some feedback on the article? :)