Polish the chapter

introduction, computational complexity.
This commit is contained in:
krahets
2023-08-20 14:51:39 +08:00
parent 5fb728b3d6
commit 2626de8d0b
87 changed files with 375 additions and 371 deletions
+2 -2
View File
@@ -119,7 +119,7 @@ void siftDown(maxHeap *h, int i) {
if (r < size(h) && h->data[r] > h->data[max]) {
max = r;
}
// 若节点 i 最大或索引 l, r 越界,则无继续堆化,跳出
// 若节点 i 最大或索引 l, r 越界,则无继续堆化,跳出
if (max == i) {
break;
}
@@ -135,7 +135,7 @@ void siftUp(maxHeap *h, int i) {
while (true) {
// 获取节点 i 的父节点
int p = parent(h, i);
// 当“越过根节点”或“节点无修复”时,结束堆化
// 当“越过根节点”或“节点无修复”时,结束堆化
if (p < 0 || h->data[i] <= h->data[p]) {
break;
}