Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: 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

    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
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted