Consider the following definition of HEAPIFY.
1 l = LEFT(i)
2 r = RIGHT(i)
3 if l < heap-size[A] and A[l] > A[i]
4 then largest = l
5 else largest = i
6 if r < heap-size[A] and A[r] > A[largest]
7 then largest = r
8 if largest != i
9 then exchange A[i] and A[largest]
What is the effect of calling HEAPIFY(A, i) when the element A[i] is larger than its children?© BrainMass Inc. brainmass.com October 16, 2018, 7:05 pm ad1c9bdddf
It is a very brief answer, explaining the WHY of it as well.