Loading tutorials
2*node and 2*node+1. It builds a sum segment tree and answers range queries on it. Point updates come in the next chapter.2 min read1 is the root, the children of node are 2*node and 2*node+1, and each node stores the combined value of its segment. Here we change one element and repair the tree in O(log n).2 min read>>, &, and << on integers.2 min readi & -i. Here you learn what it computes and why it moves you around the tree.2 min readi & -i isolates the lowest set bit, which is the lowbit trick from the previous chapter.2 min readi & -i, the meaning of "the sum of the first i elements", and O(log n) cost. It also assumes the Fenwick tree uses 1-based indexing.2 min readi & -i from the previous chapters. It also assumes you are comfortable with 1-indexed arrays and Big-O notation.2 min readadd and prefix operations, prefix sums, and difference arrays. A single Fenwick tree handles point updates with range sums. It cannot add a value to a whole range and still answer range sums. Two trees can.2 min readi & -i, prefix queries, and point updates.2 min read