recategorized by
753 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

2 votes
2 votes
1 answer
1
0 votes
0 votes
0 answers
2
none30 asked Jun 11, 2023
433 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
1 votes
1 votes
0 answers
3
Souvik33 asked Oct 30, 2022
391 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...
0 votes
0 votes
0 answers
4
Souvik33 asked Oct 30, 2022
316 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...