priority queues now 24 and 25

This commit is contained in:
Jidong Xiao
2024-04-03 01:59:38 -04:00
parent 2183ea7c83
commit 08ed8d4cbd
9 changed files with 9 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#include <iostream>
#include <queue>
int main() {
std::priority_queue<int> maxHeap;
maxHeap.push(3);
maxHeap.push(4);
maxHeap.push(3);
maxHeap.push(1);
maxHeap.push(5);
while (!maxHeap.empty()) {
std::cout << maxHeap.top() << " ";
maxHeap.pop();
}
std::cout << std::endl;
return 0;
}