//升序队列,小顶堆
priority_queue <int,vector<int>,greater<int> > q;
//降序队列,大顶堆
priority_queue <int,vector<int>,less<int> >q;

//greater和less是std实现的两个仿函数(就是使一个类的使用看上去像一个函数。
//其实现就是类中实现一个operator(),这个类就有了类似函数的行为,就是一个仿函数类了)

 

相关文章:

  • 2022-12-23
  • 2021-09-27
  • 2021-05-15
  • 2021-09-27
  • 2021-09-27
  • 2021-09-27
猜你喜欢
  • 2021-09-27
  • 2022-12-23
  • 2021-09-27
  • 2021-11-11
  • 2022-12-23
  • 2021-09-27
  • 2022-02-18
相关资源
相似解决方案