How to find kth largest element when array is modifiable.

Revision en1, by 444iq, 2019-09-15 19:38:29

How to find kth largest element each time where k will vary and array is modifiable. That is you can add new elements to the array

for example say array is 10 , 20 , 15.

2nd largest = 15

add 17 to array

array becomes 10 15 17 20

3rd largest = 15

Q <= 10^5.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English 444iq 2019-09-15 19:42:58 31 Tiny change: 'he array\n\nfor ex' -> 'he array\narray can have duplicates. \n\nfor ex'
en2 English 444iq 2019-09-15 19:41:41 19
en1 English 444iq 2019-09-15 19:38:29 333 Initial revision (published)