recategorized by
848 views
2 votes
2 votes
The time required to determine the minimum element from the max heap of size O(log(n)) is given by
recategorized by

1 Answer

Best answer
4 votes
4 votes

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

selected by

Related questions

1 votes
1 votes
1 answer
1
Sagar475 asked Jan 21, 2022
687 views
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 i...
1 votes
1 votes
1 answer
2
LRU asked Oct 4, 2021
505 views
Worst case time required to construct a balanced BST given a sorted array of integers which can be inserted in any order
2 votes
2 votes
1 answer
3
LRU asked Nov 22, 2021
854 views
Number different of binary search trees which can be created with the elements {12, 34, 22, 43, 13, 45, 55, 94, 99, 23} with 45 as the root is___.
1 votes
1 votes
1 answer
4
LRU asked Nov 2, 2021
391 views
What is the correct order ?