I have just read this answer and was very satisfied and it is indeed a fantastic answer. It taught me the working of BIT.
But at the end, the second last paragraph is where I am struggling. It says,
Similarly, let's think about how we would do an update step. To do this, we would want to follow the access path back up to the root, updating all nodes where we followed a left link upward. We can do this by essentially doing the above algorithm, but switching all 1's to 0's and 0's to 1's.
But if I see, take some example, it does not work just as by simply switching 1's and 0's, according to me.
e.g. lets take we want to update value at node 5 = 101 Switching 1s and 0s, we get 010... Now applying the procedure they have given earlier, we will end up updating some other node or so.
I must be getting it wrong. Please correct me.
Thank you in advance.