Question: C++ Write Code for class Write int main code to get output Enter 0 for ascending and 1 for descending order 0 Input array :



Enter 0 for ascending and 1 for descending order 0 Input array : 4326 //build_maxHeap() Input element: 9 //insert_val_maxHeap() sorted heap: 23469 On calling extract_maximum: 9 Sorted heap is 2346 Enter 0 for ascending and 1 for descending order 1 Input array : 4326 //build_minHeap() Input element: 9 //insert_val_MinHeap() sorted heap: 96432 On calling extract_minimum: 2 Sorted heap is 9643 The goal of this experiment is to gain experience ir Norking with binary heaps and priority queues. For this lab assignment, you should provide an mplementation of Priority Queue ADT using Binary Heaps. Your program should: 1. Accept a list of numbers as input 2. Build a binary heap of the given elements 3. Ask the user for the order of ascending or descending 4. Output the proper ordering for the given list (Heap Sort) 5. Print the min and max values from the list (per user's request) 6. Extract min or max value 7. Modify values in the heap 8. Add elements to the heap
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
