• 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: "Bourque, Jason" <email@hidden>
  • Date: Mon, 30 Apr 2001 14:02:24 -0400

But this one does not work with text.

Thanks,

Jason

> ----------
> From: Arthur J Knapp
> Sent: Monday, April 30, 2001 1:45 PM
> To: email@hidden
> Subject: Re: Fastest Sort for text and numbers
>
> > From: "Bourque, Jason" <email@hidden>
> > Subject: Fastest Sort for text and numbers
> > Date: Mon, 30 Apr 2001 10:58:50 -0400
>
> > 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 don't recall a specific thread, but this is my favorite stand-by:
>
> set myList to {4, 2, 1, 8, 3, 0, 7, 5, 9, 6}
>
> qSort(myList, 1, myList's length)
>
> myList
> -- > {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
>
>
> to qSort(lst, l, r)
> set {a, z, v} to {l, r, lst's item ((l + r) div 2)}
> repeat until z is less than or equal to a
> repeat while item a of lst < v
> set a to a + 1
> end repeat
> repeat while item z of lst > v
> set z to z - 1
> end repeat
> if a is less than or equal to z then
> set {lst's item z, lst's item a, a, z} to ,
> {lst's item a, lst's item z, a + 1, z - 1}
> end if
> end repeat
> if l < z then qSort(lst, l, z)
> if r > a then qSort(lst, a, r)
> end qSort
>
>
>
> Arthur J. Knapp
> http://www.stellarvisions.com
> mailto:email@hidden
>
> Hey, check out:
> http://www.AppleScriptSourceBook.com
> _______________________________________________
> applescript-users mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/applescript-users


  • Prev by Date: Re: Fastest Sort for text and numbers
  • Next by Date: Re: Scheduling script execution
  • Previous by thread: Re: Fastest Sort for text and numbers
  • Next by thread: URL Access Scripting
  • Index(es):
    • Date
    • Thread