Fenwick Tree / Binary Indexed Tree (Fenwick tree) learning

Binary Indexed Tree role

Binary Indexed Tree (BIT) now used for the preamble and number of columns computationally efficient, and interval. It can be obtained in any of O (logn) time and preamble (prefix sum). As a array [2,5, -1,3,6], to calculate the second element and the fourth element: -1 + 5 + 3 = 7.

BIT holding portion by the respective sum nodes, then traversing the tree from the leaves to the root to obtain total sum.

Great God video

Guess you like

Origin www.cnblogs.com/johnnyzhao/p/12452792.html