• 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: "Arthur J Knapp" <email@hidden>
  • Date: Tue, 01 May 2001 09:40:16 -0400

> From: "Bourque, Jason" <email@hidden>
> Subject: RE: Fastest Sort for text and numbers
> Date: Mon, 30 Apr 2001 14:02:24 -0400

> But this one does not work with text.

???

I don't understand what you mean. Did you try it with text?


set myList to {"ghi", "abc", "def"}

my qSort(myList, 1, length of myList)

myList
-- > {"abc", "def", "ghi"}


If you need to "consider" case, hyphens, etc, you can call
the handler from within a considering statement:

considering case and expansion

my qSort( myList, 1, length of myList )

etc.

>> 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.seanet.com/~jonpugh/


  • Prev by Date: Re: Finding default browser with AS
  • Next by Date: Re: Fastest Alphabetizer(sorter) for Lists
  • Previous by thread: Re: Fastest Sort for text and numbers
  • Next by thread: Re: move font file from font folder
  • Index(es):
    • Date
    • Thread