头文件:#include<queue>

操作:

  • top 访问队头
  • empty 队列是否为空
  • size 返回队列元素个数
  • push 插入元素到队尾
  • pop 弹出队头
  • swap 交换内容

定义:

 /*
Type 数据类型
Container 容器类型(必须是vector,deque等数组实现的容器)
Functional 比较方式
*/
priority_queue<Type, Container, Functional> //实例
//升序队列
priority_queue <int,vector<int>,greater<int> > q;
//降序队列
priority_queue <int,vector<int>,less<int> >q; //greater和less是std实现的两个仿函数(就是使一个类的使用看上去像一个函数。其实现就是类中实现一个operator(),这个类就有了类似函数的行为,就是一个仿函数类了)

最新文章

  1. Spring+SpringMvc+Mybatis框架集成搭建教程二(依赖配置及框架整合)
  2. Pyqt 控件的信号槽事件定义方法
  3. Javascript轮播 支持平滑和渐隐两种效果(可以只有两张图)
  4. fsn文件解析(C#)
  5. NCPC 2015 October 10, 2015 Problem D
  6. 312. Burst Balloons
  7. Apache配置虚拟主机后,不能访问localhost的问题
  8. ●UOJ 34 多项式乘法
  9. SQL SERVER 2008远程数据库移植到本地的方法
  10. [Swift]LeetCode346. 从数据流中移动平均值 $ Moving Average from Data Stream
  11. 解决解决httpd: Could not reliably determine the server&#39;s fully qualified domain name
  12. lemon special judge模板
  13. spring boot(十一):Spring boot中mongodb的使用
  14. Android Studio导入系统 jar包,编译时优先于查找系统SDK
  15. JavaScript中this的用法 及 如何改变this的指向
  16. file 文件上传后缀转化小写
  17. 使用Swashbuckle.AspNetCore生成.NetCore WEBAPI的接口文档
  18. C#操作Sqlite快速入门及相关工具收集
  19. 数组元素的移动(删除) C#实现
  20. Scrum Meeting 11.10

热门文章

  1. AndroidStudio 编译失败;Caused by: org.gradle.api.resources.ResourceException: Could not get resource..
  2. 微信小程序入门基础
  3. Linux上的Systemctl命令
  4. Redis SDS 深入一点,看到更多!
  5. 【部分】Asp.Net Mvc 控制器与视图的数据传递
  6. 一.vue 初识
  7. actuator与spring-boot-admin 可以说的秘密
  8. React源码之组件的实现与首次渲染
  9. suprious weakup
  10. Python 之父说 Python 历史