Hi everyone, I'm currently studying BIT on Cp-Algorithms and got confused on the range updates and range queries part. So basically I saw them using a method that's relatively easy to understand to solve range updates and point queries, but suddenly change to another more confusing method to calculate range updates and range queries.
but later on they change to use ...
so my question is pretty obvious : If I can calculate point queries ( the point_query
function from range updates and point queries method) for both the l-1 and r point, why bother changing the method ?
I'm well aware that this question occurred mean I've not fully understand BIT yet. Please answer my question if you can. Thank you for your time !!!
Link to the original code in case you want more details : link