use the above UML diagram to write a class implementing a priority queue implemented as a heap.
The class has the following attributes:
queue – a pointer that holds the memory address for a dynamically allocated array of integers used to store the heap.
length – the current “length” of the heap.
capacity – the number of elements of the dynamically allocated array.
The class has the following private methods:
reheapup – used to restore the heap after a value has been queued.
reheapdown – used to restore the heap after a value has been dequeued.
The class has the following public methods:
constructor – accepts an integer argument and initializes the class.
copy constructor – initializes the class with PQueue argument it accepts
destructor – takes care of the dynamically allocated array
operator= – assigns the rhs argument to the object
operator== – returns true if both heaps are exactly the same
operator< – returns true if the lhs heap has fewer nodes than the right
enqueue – adds a new value to the heap.
dequeue – removes the highest value
clear – resets the object to it’s initial state
isFull – returns true if the array is full, false otherwise
isEmpty – returns true if the array is empty, false otherwise.