1 votes 1 votes A min heap of size 2048 is stored on an array with array indices [1..2048] is stored and the minimum number of comparisons required to determine the maximum of element is _______.(Assume that we are allowed to access the array indexes) DS data-structures binary-heap numerical-answers applied-gate-test-series + – Sagar475 asked Jan 21, 2022 • recategorized Jul 7, 2022 by Lakshman Bhaiya Sagar475 683 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
4 votes 4 votes Max element in min heap will present at leaf node. Min heap has 2048 elements. #leaf nodes = $\left \lceil 2048/2 \right \rceil$ = 1024 So in total min number of comparisons needed = 1024 – 1 = 1023 PS: Good thing to remember, In a binary heap of ‘n’ nodes there are exactly $\left \lceil n/2 \right \rceil$ leaf nodes. Refer: https://stackoverflow.com/questions/40665736/how-do-you-prove-there-are-ceiln-2-leaves-in-a-binary-heap-of-n-nodes Shoto answered Jan 21, 2022 • edited Jan 21, 2022 by Shoto Shoto comment Share Follow See 1 comment See all 1 1 comment reply raja11sep commented Jan 21, 2022 reply Follow Share Nice answer @adad20. Even if duplicate elements are present then also no issue. 2 votes 2 votes Please log in or register to add a comment.