Thread: sort algorithm (merge?)

  1. #1
    Registered User mouse163's Avatar
    Join Date
    Dec 2002
    Posts
    49

    sort algorithm (merge?)

    Hello everybody,
    was wondering which would be the appropriate approach
    to merge and sort 2 filled arrays (ints).
    I have tried to implement a merge sort..
    but am wondering if this is the correct approach..
    Thanks alot
    Mouse

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Sort both lists (if they aren't already) and merge the lists together to make a single sorted list.

    Merge sort doesn't typically take 2 arrays as its input. The name of the algorithm comes from its divide-and-conquer (recursive) strategy, which is to split the array to be sorted in half, sort each half, and merge them back together.

    The "merge them back together" part of the algorithm, you can use once you're two lists are sorted. You can use whatever sorting algorithm you like to sort your two lists before you merge them together.

    merge sort

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Merge Sort the best sorting algorithm?
    By sehr alt in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 06-20-2007, 02:19 PM
  2. Merge Sort Help
    By blindman858 in forum C++ Programming
    Replies: 5
    Last Post: 05-14-2005, 09:47 PM
  3. Merge Sort
    By blindman858 in forum C++ Programming
    Replies: 2
    Last Post: 05-12-2005, 11:14 AM
  4. threaded merge sort
    By AusTex in forum Linux Programming
    Replies: 4
    Last Post: 05-04-2005, 04:03 AM
  5. help with merge sort
    By maloy in forum C Programming
    Replies: 4
    Last Post: 03-04-2002, 06:22 PM