Can u please tell both the complexities.Time complexity will be O(nklogk) or O(nlogk)?
Time ans space complexities?
if each array has n elements and there are k arrays.
total elements = nk
and you do heap operation nk times(for each element, you pick it up from heap), heap is always of size k , so one operation cost you logk
time complexity is O(nklogk)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.