Re: Merge sort
- From: Frank Kotler <fbkotler@xxxxxxxxxxx>
- Date: Sat, 27 Jan 2007 14:16:01 GMT
//\\o//\\annabee wrote:
På Sat, 27 Jan 2007 10:23:02 -0000, skrev Foolad <fooladgh@xxxxxxxxx>:
Hello,
Can anybody help me implementing merge sort algorithm with 68000
assembly language?
I don't know where to begin.
Thanks.
Whats a merge sort?
Wannabee, let me introduce you to my friend Google! Here's the Official US Gubmint definition:
http://www.nist.gov/dads/HTML/mergesort.html
The Wikipedia entry is more useful:
http://en.wikipedia.org/wiki/Merge_sort
The gist of it is:
-------------------------
Conceptually, merge sort works as follows:
1. Divide the unsorted list into two sublists of about half the size
2. Sort each of the two sublists recursively until we have list sizes of length 1, in which case the list itself is returned
3. Merge the two sorted sublists back into one sorted list.
The algorithm was invented by John von Neumann in 1945.
------------------
These "recursive" sorts don't *sound* to me like they'd be fast, but apparently they are (depending on data, apparently).
Why do you want one, and what is the problem you need to solve?
Well, sounds like it might be homework. He wants to implement a merge sort in 68k assembly (Do *you* know any 68k assembly? I don't!), "why" is his business...
If you don't know where to begin, Foolad, start with what you're given - the data to sort. In what form will this data be, and how will you access it? How will you determine where the "middle" is? How will you divide it into two lists? I suspect this will involve memory allocation, so learn how to do that on your system, if you don't know. Your routine will be more flexible if you can provide the actual comparison routine as a "callback". Then "repeat until done", I guess, and spew it back somehow. The "somehow" may be specified in the assignment/program-specs. Good luck!
Best,
Frank
.
- Follow-Ups:
- Re: Merge sort
- From: //\\\\o//\\\\annabee
- Re: Merge sort
- From: Herbert Kleebauer
- Re: Merge sort
- References:
- Merge sort
- From: Foolad
- Re: Merge sort
- From: //\\\\o//\\\\annabee
- Merge sort
- Prev by Date: Re: Merge sort
- Next by Date: Re: Merge sort
- Previous by thread: Re: Merge sort
- Next by thread: Re: Merge sort
- Index(es):
Relevant Pages
|