recategorized by
855 views
0 votes
0 votes

A ) 

B ) 

C ) 

D ) 

recategorized by

2 Answers

4 votes
4 votes

Answer will be max heap of size n.

We can access first max element from max heap in O(1). 

After that just delete k max element from heap and after every delete heapify the tree make sure it is max heap, which will take O(logn). 

So for K element time complexity will be O(klogn). And K is constant so O(logn).  

0 votes
0 votes
Min Heap of Size of K. If size exeeds k, pop the top element out of Min heap

Related questions

688
views
1 answers
2 votes
rasto mapp asked Jan 21, 2018
688 views
I think its none of the above?
2.2k
views
1 answers
0 votes
Overflow04 asked Jun 29, 2022
2,219 views
Someone please explain the login behind the explanation.
461
views
0 answers
0 votes
none30 asked Jun 11, 2023
461 views
What is the smallest and largest number of entries for 2-3 BTree (B2-3 Tree) of height 8 (i.e., 8 levels) ?255 and 6560127 and 2186 6561 and 255255 and 2186
412
views
0 answers
1 votes
Souvik33 asked Oct 30, 2022
412 views
A hash function h maps 16-bit inputs to 8 bit hash values. What is the largest k such that in any set of 1000 inputs, there are atleast k inputs that h maps to the same h...