Change remove to pop (#1309)

pull/1310/head
rongyi 7 months ago committed by GitHub
parent 71b7cc8ef6
commit a88c7b9862
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -96,7 +96,7 @@ impl MaxHeap {
// 交换根节点与最右叶节点(交换首元素与尾元素)
self.swap(0, self.size() - 1);
// 删除节点
let val = self.max_heap.remove(self.size() - 1);
let val = self.max_heap.pop().unwrap();
// 从顶至底堆化
self.sift_down(0);
// 返回堆顶元素

Loading…
Cancel
Save