Computer Science EngineeringVery hard

The max-heap [90, 80, 70, 60, 50] stored in an array has the key 85 inserted with the standard sift-up. The resulting array is

  1. A. 90 85 70 60 50 80
  2. B. 90 85 80 60 50 70
  3. C. 90 80 85 60 50 70
  4. D. 85 90 80 60 50 70

Correct answer: C. 90 80 85 60 50 70

85 is placed at index 6, is larger than its parent 70 so they swap, and then it stays below 90.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic