What will be the time complexity of this question(Merge k sorted Arrays using Heaps) ?
and How ?
In my opinion, it should be NKlog(3)…
Plz tell if its correct or not and what is should be.!?
What will be the time complexity of this question(Merge k sorted Arrays using Heaps) ?
and How ?
In my opinion, it should be NKlog(3)…
Plz tell if its correct or not and what is should be.!?
hello @sanjit_15
timr 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 NK elements total in worst case we will perform arounf NK operations.
so overall time complexity will be N*K log(K)
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.