Question: 1. Construct a Binary Heap using the following sequence of numbers as input. It is up to you to decide to construct a Max
1. Construct a Binary Heap using the following sequence of numbers as input. It is up to you to decide to construct a Max heap or Min heap. 28 12 17 5 7 22 13 12 4 Do all of the following. A subset of your solutions will be graded. 1. Write a Max_heapify or Min_heapify function, depending on your construction decision 2. Write a Build_heap function using the given series of numbers. 3. Write a Delete_root function to delete a root node from the heap. 4. Write a print function to display the heap. (print all nodes which have the same level in one line) Example 2 00 19 16 10 20 13 11 16 The above tree will have the following output: 20 196 15 16 4 12 2 8 10 13 12
Step by Step Solution
3.29 Rating (158 Votes )
There are 3 Steps involved in it
include using namespace std To heapify a subtree rooted with node i which is an index in arr N is si... View full answer
Get step-by-step solutions from verified subject matter experts
