Alex_Miller's blog

By Alex_Miller, 2 years ago, In English

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.

Their code for range updates and point queries

but later on they change to use ...

Another one

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

Full text and comments »

  • Vote: I like it
  • +13
  • Vote: I do not like it