This commit is contained in:
krahets
2024-04-13 21:17:44 +08:00
parent 9332a91e26
commit 6afa70e7bc
55 changed files with 334 additions and 182 deletions

View File

@ -649,7 +649,7 @@ We can encapsulate the index mapping formula into functions for convenient later
/* 获取父节点的索引 */
int parent(MaxHeap *maxHeap, int i) {
return (i - 1) / 2;
return (i - 1) / 2; // 向下取整
}
```