Re: merge sort



mooon33358@xxxxxxxxx wrote:

I have a little problem with implementing a recursive merge sort
I have to use a function mergesort that takes 3 arguments - an
array, its size, and an help array(i.e mergesort(int [] array, int
size, int[] temp] . I have to use only the temp array for the
sorting, I cant use two help arrays for the sorting, and I cant
change the signature of the function. also have a merge function
that takes 5 arguments - left array and its size, right array and
its size, and final array. I dont have a problem with the merge
function only with the mergesort. can someone post the code for it?

If the array is not essential, see about making the sorted item a
singly linked list. For such, there is adequate mergesort code in
the demonstration uses for hashlib. Lists are intrinsically
unlimited (apart from machine resources) as to size. Mergesort
uses minimal extra storage. See:

<http://cbfalconer.home.att.net/download/> (for hashlib)

--
Merry Christmas, Happy Hanukah, Happy New Year
Joyeux Noel, Bonne Annee, Frohe Weihnachten
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: Quicksort pathological behavior?
    ... > arrays) or mergesort. ... First, heapsort works fine for binary trees too, in fact ... secondary key to make heapsort be stable, or copying the whole array to ... time-enqueued is the best way to achieve stable-sort behaviour.) ...
    (comp.programming)
  • Re: Mergesort algorithm for linked lists
    ... In fact he conditionalizes whether it is natural or not. ... To do natural mergesort with arrays requires an auxilary array where item ...
    (comp.lang.c)
  • Re: merge sort
    ... I have to use a function mergesort that takes 3 arguments - an array, ... int[] temp]. ... I dont have a problem with the merge function only with the mergesort. ... "Merging means the combination of two or more ordered files ...
    (comp.lang.c)
  • Re: merge sort
    ... I have to use a function mergesort that takes 3 arguments - an array, ... int[] temp]. ... I dont have a problem with the merge function only with the mergesort. ... "Merging means the combination of two or more ordered files ...
    (comp.lang.c)