zoukankan      html  css  js  c++  java
  • 优先级队列

       1:  //file :4pqueue-test.cpp
       2:  #include <queue>
       3:  #include <iostream>
       4:  #include <algorithm>
       5:  using namespace std;
       6:   
       7:  int main()
       8:  {
       9:      //test priority queue...
      10:      int ia[9] = {0,1,2,3,4,8,9,3,5};
      11:      priority_queue<int> ipq(ia,ia+9);
      12:      cout << "size=" << ipq.size() << endl;
      13:   
      14:      for (unsigned i=0; i<ipq.size();i++)
      15:      {
      16:          cout << ipq.top() << ' ';
      17:      }
      18:      
      19:      cout << endl;
      20:   
      21:      while (!ipq.empty())
      22:      {
      23:          cout << ipq.top() << ' ';
      24:          ipq.pop();
      25:      }
      26:      cout << endl;
      27:      return 0;
      28:  }
  • 相关阅读:
    Linux 常用命令
    silky微服务简介
    okhttp中的Builder模式
    Assert in C#&Java
    Abstract类中使用@Autowire
    @Scope("prototype") bean scope not creating new bean
    【转】centos系统查看cpu内存等情况
    hdu 7013 String Mod 题解
    牛客 11259 H Scholomance Academy 题解
    bzoj 2151 种树 题解
  • 原文地址:https://www.cnblogs.com/justinzhang/p/2667213.html
Copyright © 2011-2022 走看看