mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-24 18:55:36 +08:00
build
This commit is contained in:
@ -105,7 +105,7 @@ comments: true
|
||||
// 将列表元素原封不动添加进堆
|
||||
maxHeap = nums
|
||||
// 堆化除叶节点以外的其他所有节点
|
||||
for i in stride(from: parent(i: size() - 1), through: 0, by: -1) {
|
||||
for i in (0 ... parent(i: size() - 1)).reversed() {
|
||||
siftDown(i: i)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user