Please consider the following c++ struct code without STL. Implement some max heap function. You need to use array representaion.
Hint:
1. implement the main function and seven functions.
MaxPQ:constructor i.e initialize private member
~MaxPQ:destructor i.e delete a heap array
isEmpty():check if priority queue is empty
top():return reference to the maximum element
push():insert an element to the priority queue
pop():delete the element with maximum priority
PostorderTrav():print all element with post order traversal in the priority queue
2. PostorderTrav() can use recursive format
There are multiple lines in the input.
The first line contains an integer N(0 < N <= 1000), indicating the number of instructions.
According to the different instructions, operating the different tasks.
Tree height is smaller than 10.
isEmpty():put "Yes" if the priority queue is empty, "No" otherwise.
top():if the priority queue is empty, print zero. Otherwise, print maximum element, you need to print '\n' behind an element.
print():called PostorderTrav() then print all elements with post order traversal in the priority queue, you need to print a space after every element.
pop() : if left child is the same to right child, please swap with left child.
You need to print '\n' at the end of the line.