Fenwick Trees(loonytek.com) |
Fenwick Trees(loonytek.com) |
Think what you're doing mentally when converting a binary number to decimal. For example: 101001
Each one of those 1s represents 2^position, all added together, so:
41 = 32 (100000 = 2^5)
+ 8 ( 1000 = 2^3)
+ 1 ( 1 = 2^0)
Since any natural number can be represented in decimal and binary, the rule applies that each binary 1 is the value of 2^that position, all summed up.I tried to be as intuitive as possible in my post, but kind of missed to reason about this one.
Hope you liked the article !!