What will be the complexity

what will be the time complexity of the discussed approach?

hello @Manvik-Arya-4391661007540658

time complexity will be N K log(k).

log(K) because our heap size is k ,so for any operation on heap it will take O(log(k)) time.

now because we have N K elements total in worst case we will perform arounf N K operations.
so overall time complexity will be N*K log(K)