Question: Python language 7. Write a method that receives an input array of integers and determines if it's a min-heap. Write a method that, given a

Python language  Python language 7. Write a method that receives an input array

7. Write a method that receives an input array of integers and determines if it's a min-heap. Write a method that, given a heap array, returns the second smallest element in a heap. Assume the heap has at least two elements. 8. 9. Write a method that receives a heap array and an integer k and prints all the elements in the path 10. Write the function tryReplace(heap array.k,m) that receives a heap array and integers k and m 11. 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 from index k to the root of the heap. and replaces the item at index k by m only if doing so maintains the heap property in heap_array. from 0 to i in input array form a heap. heap and the value of its parent. Write a method that receives a heap_array and returns its 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!