Question: In C++ Language, and include header file if possible. Create a Heap (min or max, your choice) class containing the standard functionality of insertion and
In C++ Language, and include header file if possible.

Create a Heap (min or max, your choice) class containing the standard functionality of insertion and removal. Use a dynamically-allocated array for storage of your heap, allowing the heap to grow as needed (no reduction of size is required). In addition, this heap allows the user to "flush" a value from the heap. In other words, the user supplies a value and the heap removes all instances of that value automatically. Because this is a structure with dynamic memory in C++, you must include the memory management methods. In your driver, test the heap by: 1) Inserting more than the default size number of values (to test insertion and resize) 2) Removing the next value and printing it to the screen (to test remove) 3) "Flushing" a given value from the heap, then removing and printing values until it is clear the flushed value has been removed (to test flush) Note that you must know a value is on the heap to know if your flush method removed it. Consequently, you must either insert one (or more) known values on the heap, or track one (or more) of the random values
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
