@LRU
Max element can be present in any of the leaf nodes of a min-heap.In a heap, the tree is a complete binary tree so the minimum element will be present either in the lowest level or second-lowest level, Now the number of elements we have to check(elements present in lowest and second-lowest level) is O(logn). So just by doing a linear search, you will get the element. Answer : O(logn).
Ref:
algorithm - Time complexity to get min elements from max-heap - Stack Overflow
https://gateoverflow.in/295138/Finding-the-minimum-element-in-a-heap
https://gateoverflow.in/889/Gate-cse-2006-question-10
64.3k questions
77.9k answers
244k comments
80.0k users