Skip to content

Commit

Permalink
Update 01.Binary-Indexed-Tree.md
Browse files Browse the repository at this point in the history
  • Loading branch information
itcharge committed Feb 24, 2022
1 parent 3ab4c3c commit c0741b7
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Contents/07.Tree/04.Binary-Indexed-Tree/01.Binary-Indexed-Tree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## 1. 树状数组简介

### 1.1 树状数组的定义

> **树状数组(Binary Indexed Tree)**:也因其发明者命名为 Fenwick 树,最早由 Peter M. Fenwick 于 1994 年以 A New Data Structure for Cumulative Frequency Tables 为题发表在 SOFTWARE PRACTICE AND EXPERIENCE。其初衷是解决数据压缩里的累积频率(Cumulative Frequency)的计算问题,现多用于高效计算数列的前缀和, 区间和。它可以以 $O(log⁡n)$ 的时间得到任意前缀 $\sum_{i=1}^{j} A[i], 1 \le j \le N$,并同时支持在 $O(log⁡n)$ 时间内支持动态单点值的修改。空间复杂度为 $O(n)$。
### 1.2 树状数组的原理

## 2. 树状数组的基本操作

### 2.1 树状数组的建立

### 2.2 树状数组的修改

### 2.3 树状数组的求和

## 4. 树状数组的常见题型

### 4.1 单点更新 + 区间求值

### 4.2 区间更新 + 单点求值

### 4.3 求逆序对数

## 参考资料

- 【书籍】ACM-ICPC 程序设计系列 - 算法设计与实现 - 陈宇 吴昊 主编
- 【书籍】算法训练营 陈小玉 著
- 【博文】[聊聊树状数组 Binary Indexed Tree - halfrost](https://halfrost.com/binary_indexed_tree/)
- 【博文】[树状数组学习笔记 - AcWing](https://www.acwing.com/blog/content/80/)

0 comments on commit c0741b7

Please sign in to comment.