Physics Forums

Physics Forums (http://www.physicsforums.com/index.php)
-   Engineering, Comp Sci, & Technology Homework (http://www.physicsforums.com/forumdisplay.php?f=158)
-   -   Merging sorted lists (http://www.physicsforums.com/showthread.php?t=192905)

kekido Oct21-07 06:31 PM

Merging sorted lists
 
1. The problem statement, all variables and given/known data
There are k sorted lists, each of which has n elements. Provide a divide and conquer algorithm that merges these lists into a single list.


2. Relevant equations
N/A


3. The attempt at a solution
If a sequential algorithm is used, the time is proportional to the length of the resulting list.
So if we merge the first two, then merge the result with the third, and so on, we get this:
2n+3n+...+kn, which is in the order of n*k^2

However, I can't find any merging algorithm that uses divide and conquer. In standard mergeSort algorithm, the merging part is also a sequential read/compare, so it takes linear time. I'm wondering if there exists a Divide and conquer algorithm for merging sorted lists?


All times are GMT -5. The time now is 02:57 AM.

Powered by vBulletin Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2014 Physics Forums