We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
首先非常感谢笔记的整理!对我帮助很大! 在书中11.5优先队列一节,用数组表示堆时,应该将0号位空着,即top函数应返回heap[1],pop时也应该将末尾元素放入heap[1],然后sink(1) 您可以运行下您这一节中的代码测试一下,我这边的测试结果如下:
q.push(2); q.push(3); cout << q.top() << endl;//输出2 q.push(1); cout << q.top() << endl;//输出2 q.push(4); cout << q.top() << endl;//输出2 q.pop();//程序崩溃 cout << q.top() << endl;
此外,top函数的返回类型应该是int,而非void
The text was updated successfully, but these errors were encountered:
感谢!下个版本即更正。
Sorry, something went wrong.
No branches or pull requests
首先非常感谢笔记的整理!对我帮助很大!
在书中11.5优先队列一节,用数组表示堆时,应该将0号位空着,即top函数应返回heap[1],pop时也应该将末尾元素放入heap[1],然后sink(1)
您可以运行下您这一节中的代码测试一下,我这边的测试结果如下:
此外,top函数的返回类型应该是int,而非void
The text was updated successfully, but these errors were encountered: