recategorized by
3,334 views
1 1 vote
What is the time complexity  to find the Kth largest element in a Min-Heap?

 Or equivalently, What is the time complexity to find Kth smallest element in Max-Heap?

1 Answer

Best answer
2 2 votes
The nth largest element will be present in one of the leaf nodes, and will take O(n/2) time to find.

Therefore O(n) is the required complexity.
Position:
Show:

Related questions

8 8 votes
3 3 answers
5.8k
5.8k views
Kapil asked Sep 4, 2016
5,818 views
In a min-heap with n elements1). The 7th smallest element can be found in time, if duplicates are allowed ?2). The 7th distinct smallest element can be found in time, I...
11 11 votes
5 answers 5 answers
5.9k
5.9k views
Vikrant Singh asked Dec 28, 2014
5,947 views
What is the complexity of finding $50^{th}$ smallest element in an already constructed binary min-heap?$\Theta(1)$$\Theta (\log n)$$\Theta (n)$$\Theta (n \log n)$
0 0 votes
0 0 answers
2.0k
2.0k views
Shubhanshu asked Oct 18, 2017
2,031 views
In a binary min heap with n elements, the 7th smallest element can be found in _____ ?Answer given is O(logn) and solution:-Delete the 1st smallest element O(logn)Delete ...
1 1 vote
1 1 answer
1.6k
1.6k views