Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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, 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started