Question: Write a program that allows the user to perform the following operations on a min-heap H using an array in C or C++ .(a) create-min-heap():
Write a program that allows the user to perform the following operations on a min-heap H using an array in C or C++
.(a) create-min-heap(): create a min-heap;
(b) delete-min(): delete the minimum key from the min-heap;
(c) change-key(k,k ): replace the key k with k ;
(d) insert(k): insert key k to the min-heap;
(e) print(): print out the properties of the heap H, including the size of the heap and the current minimum key; (f) print-content(): print out the content of the heap by iterating all the keys in the underlying array sequentially;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
