Question: 6. Write a C++ program called heap.cpp to conduct heap operations. When the program starts, it should read a set of numbers from a user.

 6. Write a C++ program called heap.cpp to conduct heap operations.

When the program starts, it should read a set of numbers from

6. Write a C++ program called heap.cpp to conduct heap operations. When the program starts, it should read a set of numbers from a user. After that, your program should display if it's a heap or not. If it's not a heap, your program should construct a heap with the numbers. Then, your program should conduct heap operation(s). For the homework, your heap should be implemented using a dynamic array The following presents a sample run of the program. Input size: 5 Enter numbers: 20 7 8 1 3 This is a heap. Select an operation 1: Insert a number 2. Delete the max 3. Heapsort &Quit Enter a number: 5 Updated heap: 2078 1 3 5 Select an operation 1: Insert a number 2. Delete the max 3. Heapsort &Quit 2 Updated heap: 8751 3 Select an operation 1: Insert a number 2. Delete the max 3. Heapsort &Quit 2 Updated heap: 7351 Select an operation 1: Insert a number 2. Delete the max 3. Heapsort &Quit Heapsort: 75 3 1 Bye

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!