Algorithm 1 Minimum Heapify

1:procedure MinHeapify(A,iA, i)

2:l=l = Left(ii)

3:r=r = Right(ii)

4:if lA.heap-sizel\le A.\text{heap-size} and A[l]<A[i]A[l] < A[i] then

5:smallest=lsmallest = l

6:else

7:smallest=ismallest = i

8:end if

9:if rA.heap-sizer\le A.\text{heap-size} and A[r]<A[i]A[r] < A[i] then

10:smallest=rsmallest = r

11:end if

12:if smallestismallest \ne i then

13:exchange A[i]A[i] with A[smallest]A[smallest]

14:MaxHeapify(A,smallestA, smallest)

15:end if

16:end procedure