Answered step by step
Verified Expert Solution
Question
1 Approved Answer
All of the questions in this homework involve heap data structure and heapsort. Assume that the heap is constructed in an array A. The size
All of the questions in this homework involve heap data structure and heapsort. Assume that the heap is constructed in an array A. The size of the array is n. The elements in the array are indexed as 0,1,..., -1. Answer the following questions. 1. Write the pseudocode to find the parent, left child, and right child of node i in the heap 2. What are the minimum and maximum number of elements in a heap of height h? 3. Write down the pseudocode for Max-Heapify 4. What is the effect of calling Max-Heapify(A, i) when the element Ali is larger than its children? 5. Write down the pseudocode to build a max heap in the array A 6. Write down the pseudocode to sort (in ascending order) the elements in A using heap 7. What is the runtime of the heapsort algorithm
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