Question: 5. Build a min-heap using the sequence of insertions 7, 1,2, 6, 10, 12, 11, 4,8,3,9,5 6. Consider the array A (2,6,1,5,9,3,8,4,7). Trace the execution

 5. Build a min-heap using the sequence of insertions 7, 1,2,

5. Build a min-heap using the sequence of insertions 7, 1,2, 6, 10, 12, 11, 4,8,3,9,5 6. Consider the array A (2,6,1,5,9,3,8,4,7). Trace the execution of heapsort(a) 7. Write a method that receives an input array of integers and determines ifit's a min-heap. 8. Write a method that, given a heap_array, returns the second smallest element in a heap. Assume the heap has at least two elements. Write a method that receives a heap array and an integer k and prints all the elements in the path from index k to the root of the heap. 9. 10. Write the function tryReplace(heap array, k,m) that receives a heap_array and integers k and m and replaces the item at index k by m only if doing so maintains the heap property in heap from 0 to i in input array form a heap. heap and the valuc of its parent. Write a method that receives a heap array and returns its 1. Write a function that, given an input array, finds the largest array index i such that all numbers 12. Let's define generation gap as the maximum difference between the value of an element in the generation gap

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!