Question: You are given k sorted lists L1, L2, . . . , Lk of numbers. Let n denote the total length of all these lists.
You are given k sorted lists L1, L2, . . . , Lk of numbers. Let n denote the total length of all these lists. Describe an algorithm that returns one list containing all these n numbers in sorted order. The running time of your algorithm must be O(n log k). Explain why your algorithm is correct and why the running time is O(n log k). Hint: If k = 2, this should look familiar.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
