mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-15 05:00:59 +00:00
build
This commit is contained in:
@@ -9,7 +9,7 @@ comments: true
|
||||
- 「大顶堆 Max Heap」,任意结点的值 $\geq$ 其子结点的值;
|
||||
- 「小顶堆 Min Heap」,任意结点的值 $\leq$ 其子结点的值;
|
||||
|
||||

|
||||

|
||||
|
||||
## 8.1.1. 堆术语与性质
|
||||
|
||||
@@ -318,7 +318,7 @@ comments: true
|
||||
|
||||
具体地,给定索引 $i$ ,那么其左子结点索引为 $2i + 1$ 、右子结点索引为 $2i + 2$ 、父结点索引为 $(i - 1) / 2$ (向下整除)。当索引越界时,代表空结点或结点不存在。
|
||||
|
||||

|
||||

|
||||
|
||||
我们将索引映射公式封装成函数,以便后续使用。
|
||||
|
||||
@@ -1427,7 +1427,7 @@ $$
|
||||
T(h) = 2^0h + 2^1(h-1) + 2^2(h-2) + \cdots + 2^{(h-1)}\times1
|
||||
$$
|
||||
|
||||

|
||||

|
||||
|
||||
化简上式需要借助中学的数列知识,先对 $T(h)$ 乘以 $2$ ,易得
|
||||
|
||||
|
||||
Reference in New Issue
Block a user