Re:Quicksort
Re:Quicksort
- Subject: Re:Quicksort
- From: Bernard Azancot <email@hidden>
- Date: Thu, 15 Jul 2004 01:18:41 +0200
On Jul 14, 2004, at 18:56, Graff <email@hidden> wrote:
Quicksort is potentially the fastest sort out there for large,
completely unordered data sets. If the data is semi-ordered then a
quicksort can be sub-optimal.
(<http://www.mathcs.carleton.edu/courses/course_resources/cs227_w96/
swanjorg/algosort.html>)
Bubblesort is pretty slow but it is simple to implement and understand.
The unix sort shell tool works well but it can be a pain to use,
especially with large sorts.
I don't know much about the perldoc sort.
For AppleScript sorts I would use a bubblesort if you are sorting up
to 1000 items or so. At that amount of objects speed really isn't much
of a factor. For 1,000 to 100,000 items I'd use one of the quicksort
algorithms - preferably a modified quicksort (known as an introsort)
that resorts to a heapsort for the final stages of sorting.
For anything more than 100,000 items I'd turn to a different
programming language. For example, C has a nice built-in quicksort
that is very customizable and you can generally get a C program to run
many times faster than an AppleScript one.
- Ken
OK.
Thanks, Ken.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.