ISRO Scientist/Engineer CSE 2018Data Structures › Not yet assigned to a topic
ISRO Scientist/Engineer CSE 2018 PYQ: Given a binary-max heap. The elements are stored in an arrays as $25, 14, 16, 13, 10, 8, 12$. What is the…
Given a binary-max heap. The elements are stored in an arrays as $25, 14, 16, 13, 10, 8, 12$. What is the content of the array after two delete operations?
- A14,13,8,12,10
- B14,12,13,10,8
- C14,13,12,8,10Correct answer
- D14,13,12,10,8
Answer
(C) $14,13,12,8,10$
Approach
A max-heap delete operation always removes the root (maximum element). The standard algorithm replaces the root with the last element, reduces the heap size by one, and then performs a top-down heapify (sift-down) to restore the max-heap property. We apply this procedure twice to the given array.
Reviewed by ISRO IQ Editorial Team.