Skip to content

Instantly share code, notes, and snippets.

@Taohid0
Last active January 8, 2019 11:09
Show Gist options
  • Save Taohid0/d7f94d52c367b8040f2ce6d63fdf7286 to your computer and use it in GitHub Desktop.
Save Taohid0/d7f94d52c367b8040f2ce6d63fdf7286 to your computer and use it in GitHub Desktop.
min priority queue using greater
#include <bits/stdc++.h>
using namespace std;
int main()
{
int value;
priority_queue<int,vector<int>,greater<int> >pq;
pq.push(1);
pq.push(2);
pq.push(3);
while(!pq.empty())
{
value = pq.top();
pq.pop();
cout<<value<< " ";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment