Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Heap using dynamically allocated array in C++ Create a Heap (min or max,, your choice) class containing the standard functionality of insertion and removal .

Heap using dynamically allocated array in C++

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 hea, 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

Students also viewed these Databases questions

Question

4. Who would lead the group?

Answered: 1 week ago

Question

2. What type of team would you recommend?

Answered: 1 week ago