1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Merging sorted lists

  1. Oct 21, 2007 #1
    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?
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?