what is the time complexity of merge k sorted array using heap
Merge k sorted array
Hello @shashankmaheshwari054
Complexity Analysis:*
- Time Complexity : O( n * k * log k), Insertion and deletion in a Min Heap requires log k time. So the Overall time compelxity is O( n * k * log k)
- Space Complexity : O(k), If Output is not stored then the only space required is the Min-Heap of k elements. So space Comeplexity is O(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.