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

1 Answer

Best answer
3 3 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
Position:
Show:

Related questions

1 1 vote
1 1 answer
1.1k
1.1k views
Sagar475 asked Jan 21, 2022
1,090 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...
2 2 votes
1 answers 1 answer
1.3k
1.3k views
LRU asked Nov 22, 2021
1,344 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 1 vote
1 answers 1 answer
888
888 views
LRU asked Oct 4, 2021
888 views
Worst case time required to construct a balanced BST given a sorted array of integers which can be inserted in any order
1 1 vote
1 answers 1 answer
950
950 views
LRU asked Nov 2, 2021
950 views
What is the correct order ?