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 9, 2019, 7:00 pm ad1c9bdddf
It is a very brief answer, explaining the WHY of it as well.