• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fastest Sort for text and numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fastest Sort for text and numbers


  • Subject: Re: Fastest Sort for text and numbers
  • From: Timothy Bates <email@hidden>
  • Date: Tue, 01 May 2001 11:57:24 +1000

On 1/05/2001 12:58 AM, "Bourque, Jason" <email@hidden> wrote:
> I know this has come up before but I can't find the thread for it.
> Does anyone have the sorting routine that was deemed the fastest?

I now use

this combo that Howard Peters sent me. It is very fast due to use of
references. look out for line wraps in the brain-dead mailing software that
no-one knows how to fix...

on sort(TheList)
set qlist to TheList
my qsort(a reference to qlist, 1, count of qlist)
return qlist
end sort

--qsort is used by sort
on qsort(the_list, startIndex, finishIndex)
set i to startIndex
set j to finishIndex
set mid to item ((i + j) div 2) of the_list
repeat
repeat while ((item i of the_list) < mid)
set i to i + 1
end repeat
repeat while ((item j of the_list) > mid)
set j to j - 1
end repeat
if i > j then
set {item i of the_list, item j of the_list} to {item j of
the_list, item i of the_list}
set {i, j} to {i + 1, j - 1}
end if
if i > j then exit repeat
end repeat

if j > startIndex then qsort(the_list, startIndex, j)
if i < finishIndex then qsort(the_list, i, finishIndex)
end qsort


  • Prev by Date: Re: Finding default browser with AS
  • Next by Date: Re: move font file from font folder
  • Previous by thread: Re:Variable as a Property (was default browser)
  • Next by thread: Re: Fastest Sort for text and numbers
  • Index(es):
    • Date
    • Thread