recategorized by
1,112 views
7 votes
7 votes
From an array of size n , we need to find the k bigger elements. What is the data structure we should use to find k bigger element in best asymptotic complexity?

 1.A max heap of size n.

 2. A max heap of size k.

 3. A min heap of size n.

  4.A min heap of size k.
recategorized by

2 Answers

0 votes
0 votes
Max heap of size k...so that TC becomes 0(klogk)
edited by

Related questions

0 votes
0 votes
0 answers
1
iarnav asked Jun 24, 2018
255 views
The number of possible min-heaps containing each value from {1,1,1,1,1,1,1} exactly once is _______This is a variance of Gate 2018 question and how will we deal if all va...
0 votes
0 votes
0 answers
2
Balaji Jegan asked Jun 17, 2018
220 views
What is the recurrence relation / math expression for the number of binary min heaps possible with "n" elements on which "k" elements are repeated "t" times where t=2 to ...
2 votes
2 votes
1 answer
3
Balaji Jegan asked Mar 3, 2018
1,057 views
How many Binary Max-Heaps can be constructed from the elements {1,1,2,2,3,3,4,4} ?
4 votes
4 votes
2 answers
4
jenny101 asked Oct 26, 2016
1,108 views