Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

create max_heap.md #655

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions priority_queue/max_heap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// program that checks if priority_queue is a Max Heap

std::priority_queue<int> my;
//load priority_queue with elements
my.push(2);
my.push(10);
my.push(4);
my.push(6);
my.push(8);

// iterates entire queue and one by one extracts items from max heap
while (!my.empty())
{
std::cout << my.top() << " ";
my.pop();
}

return 0;

//exspected output should be "10 8 6 4 2"