Consider the following incomplete Algorithm of Heapify Function

HEAPIFY (A, i)

1. l = LEFT (i)

2. r = RIGHT (i)

3. if l ≤ A. heap-size and A[l] > A[i]

4. largest = l

5. else largest = i

6. if r ≤ A.heap-size and X

7. largest = r

8. if Y

9. exchange A[i] with A[largest]

10. MAX-HEAPIFY (A, largest)

Which of the following expression can be placed at X and Y respectively, for the above algorithm to work correctly?

1
A[r] > A[i], A[largest]>A[i]
2
A[r] > A[i], A[r] > A[i]
3
A[r] > A[l], largest != i
4
A[r] > A[largest], largest ! = i

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation