Fenwick Tree Algorithms Pseudocode