Re: Sort items in a list without OSAXen
Re: Sort items in a list without OSAXen
- Subject: Re: Sort items in a list without OSAXen
- From: Arthur J Knapp <email@hidden>
- Date: Tue, 04 Sep 2001 16:15:33 -0400
>
Date: Tue, 4 Sep 2001 17:57:42 +0200
>
From: Emmanuel <email@hidden>
>
Subject: Re: Sort items in a list without OSAXen
>
size = size of the list (random integers in the range 1 - 500)
>
SRN = "SortedRefNumbers" (Arthur's)
>
s = "sort" (Smile's)
>
SN = "SortedNumbers" (Arthur's)
>
>
Timings = milliseconds, performed on a Pismo under 0S9.1. Average over 5 runs.
>
>
size SRN s SN
>
--------------------------------
>
25 0 33 47
>
50 7 143 207
>
200 88 1217 8103
>
500 93 7100 (still in progress at the time of this writing:)
Wow, Emmanuel, Smile's sort is really great!!! :)
The odd thing is, I could swear that I had tested your "sort" handler
in the past, yet I don't remember it being this fast, (I DO remember it
being fast, just not THIS fast).
>
What seems striking at this step is that SRN does not scale like the
>
others, which go nearly like n^3 or n^4. More like linear.
An academic point at best. SRN is extremely bugging:
Both Victor Yee and myself found our script editors suddenly typing
inverted carets after running SortedRefNumbers. As Victor says, it
looks like "you'd written an ingenious copy-protection scheme". ;-)
(has anyone every seen this behavior before?).
The fix that I posted corrected the abberant behavior, but I would
really like to find the actual cause. It's somewhat unnerving to see
the Script Editor just typing on it's own...
Initially, I thought Smile's sort was a type of mergesort, but in
fact, it is far more clever than that. It has so few lines, and yet
it produces a very effiecient divide-and-conquer scheme. I intend to
intensely study it over the next few days, (which is why I don't
have girlfriends). ;-)
P.S. Now, where did I put that old quicksort of mine???...
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.eremita.demon.co.uk/scripting/applescript/