adding min heap notes

This commit is contained in:
Jidong Xiao
2023-11-20 16:58:55 -05:00
parent 4e0a37792b
commit 6240353c8c
3 changed files with 102 additions and 1 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;
}