...
NTA UGC NET DEC-2022 Paper-2
October 9, 2023
Computer-Networks
October 9, 2023
NTA UGC NET DEC-2022 Paper-2
October 9, 2023
Computer-Networks
October 9, 2023

Data-Structures

Question 7

Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is _______.

A
511
Question 7 Explanation: 
The binary heap contains 1023 elements.
When it performs minimum comparisons it will take Ceil(n/2)
n=1023
= Ceil(1023/2)
= 512
So, the maximum element is also part of n/2.
So, we have to subtract from the total elements
= 512-1
= 511
Correct Answer: A
Question 7 Explanation: 
The binary heap contains 1023 elements.
When it performs minimum comparisons it will take Ceil(n/2)
n=1023
= Ceil(1023/2)
= 512
So, the maximum element is also part of n/2.
So, we have to subtract from the total elements
= 512-1
= 511

Leave a Reply

Your email address will not be published. Required fields are marked *