Question: Exercise 2 . 1 MAX - Heapify ( } A , i 1 l } leftarrow operatorname { LEFt } ( i r

Exercise 2.1 MAX-Heapify (}A,i
1 l}\leftarrow\operatorname{LEFt}(i
r\leftarrowRIGHT(i)
if l \leq heap-size[A] and A[l]>A[i]
then largest }\leftarrow
else largest }\leftarrow
if r\leq heap-size[A] and A[r]>A[largest]
then largest }\leftarrow
if largest }
eq=
then exchange A[i]\leftrightarrowA[largest]
MAX-HEAPIFy(A, largest)
Give an iterative (loop - based) definition of the Max-Heapify algorithm.
Exercise 2.3
Using Figure 6.4 on page 161 in the textbook as a model, illustrate the operation of
Heap sort on the array A=[6,12,1,28,7,19,22,8,2]
For each of the following equations show whether it is true or false:
x2=O(x3)
x3=O(x2)
5x3+3x2=(x4)
3x2+5x+2=(x2)
2n+1=O(2n)
3n=O(2n)
3n=(2n)
Exercise 2 . 1 MAX - Heapify ( } A , i 1 l } \

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 Programming Questions!