Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a C++ program called heap.cpp to implement the heap algorithm. The heap

ID: 3625102 • Letter: 1

Question

1. Write a C++ program called heap.cpp to implement the heap algorithm. The heap should be implemented in an array that can hold up to 250 elements. The following presents a sample run. (THIS PROGRAM MUST USE HEAP ALGORITHM)

Enter the number of elements: 6
Enter 6 elements: 2 9 7 6 5 8
Heap constructed: 9 6 8 2 5 7
Select Option (1: Insert, 2: Delete Max, 3: Exit): 1
Enter a new element to be inserted: 10
Updated heap: 10 6 9 2 5 7 8
Select Option (1: Insert, 2: Delete Max, 3: Exit): 2
Updated heap: 9 6 8 2 5 7
Select Option (1: Insert, 2: Delete Max, 3: Exit): 2
Updated heap: 8 6 7 2 5
Select Option (1: Insert, 2: Delete Max, 3: Exit): 3
Bye

Explanation / Answer

I wrote this a while ago you can modify it to work as you desired... #include #include int heapSize = 10; void print(int a[]) { for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote