其他分享
首页 > 其他分享> > Binary Indexed Tree

Binary Indexed Tree

作者:互联网

A Fenwick tree or binary indexed tree is a data structure that can efficiently update elements and calculate prefix sums in a table of numbers. It's actually an array rather than a real tree. Note that its index begins from 1 rather 0.

Given an array arr[1...n], three are mainly two methods:

1.prefixSum

2.update

Visualization

Reference

  1. https://en.wikipedia.org/wiki/Fenwick_tree
  2. https://blog.csdn.net/Yaokai_AssultMaster/article/details/79492190
  3. https://www.geeksforgeeks.org/binary-indexed-tree-or-fenwick-tree-2/
  4. https://leetcode.com/problems/reverse-pairs/discuss/97268/general-principles-behind-problems-similar-to-reverse-pairs

标签:Binary,idx,index,int,tree,Tree,current,...,Indexed
来源: https://www.cnblogs.com/xiaofulan/p/11067136.html