fix poll() in my_heap.cpp (#360)

pull/361/head
LoneRanger 2 years ago committed by GitHub
parent ea5677b3c6
commit 8d8b713865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,8 +99,7 @@ public:
void poll() {
// 判空处理
if (empty()) {
cout << "Error:堆为空" << endl;
return;
throw out_of_range("堆为空");
}
// 交换根结点与最右叶结点(即交换首元素与尾元素)
swap(maxHeap[0], maxHeap[size() - 1]);

Loading…
Cancel
Save