Heap
Question 1 |
An array [82, 101, 90, 11, 111, 75, 33, 131, 44, 93] is heapified. Which one of the following options represents the first three elements in the heapified array?
82, 90, 101 | |
82, 11, 93 | |
131, 11, 93 | |
131, 111, 90 |
Question 1 Explanation:
After heapifying the given array, the root element will be the maximum value. So, the root element is 131.
Now, let's consider the options again:
(A) 82, 90, 101 - This cannot be correct because the root element, which is the maximum, is not included.
(B) 82, 11, 93 - This cannot be correct because the second element is not necessarily the second maximum in the array.
(C) 131, 11, 93 - This cannot be correct because 11 and 93 are not necessarily the next largest values after the root.
(D) 131, 111, 90 - This is the most likely option because after the root (131), the next largest values in the array are 111 and 90.