STL

priority_queue

  1. #include<queue>
  2. //最小堆
  3. priority_queue <int,vector<int>,greater<int> > q;
  4. //最大堆,默认
  5. priority_queue <int,vector<int>,less<int> >q;