![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
优先队列
请多指教^_^
这个作者很懒,什么都没留下…
展开
-
二叉堆实现优先队列(大根堆、小根堆)
大根堆大根堆是根节点比其儿子结点值要大的二叉堆,故优先队列的队首数值是最大的。具体实现见代码:#include<iostream>#include<cstdio>using namespace std;const int maxn = 1000;class Priority_queue //大根堆,优先队列{public: int heap[maxn], tot; Priority_queue(); ~Priority_queue(); void原创 2020-10-20 16:50:16 · 365 阅读 · 0 评论 -
优先队列易忘点
重载函数相关点:(只针对大顶堆的优先队列)#include<iostream>#include<queue>using namespace std;struct node{ int x; bool operator < (const node b)const { return x > b.x; }};priority_queue<node> p;int main(){ ios::sync_with_stdio(fals原创 2020-06-25 22:18:02 · 89 阅读 · 0 评论