堆(优先队列)基础

来源:互联网 发布:手机淘宝如何投诉客服 编辑:程序博客网 时间:2024/05/04 13:52

1.建队列
利用自带的stl模板

#include<queue>priority_queue<int>q;//priorioty_queue<int,vector<int>>,greater<int>q;

2.基本操作

q.pop()//弹出队顶q.top()//返回队首q.push(n)//推进队列
原创粉丝点击