Re: Quicksort Implementation v1.0.2
Re: Quicksort Implementation v1.0.2
- Subject: Re: Quicksort Implementation v1.0.2
- From: Nigel Garvey <email@hidden>
- Date: Sat, 2 Aug 2003 17:47:22 +0100
Emmanuel wrote at 08:47 my time:
>
However, quicksort is recursive and people who use it live dangerously. For
>
instance, you would think that quicksort can safely sort a list of 400
>
items, wouldn't you? Now try to sort that list (I'm not considering lists
>
of lists here, just ordinary lists of integers):
>
>
---------------------
>
set x to {}
>
repeat with i from 1 to 200
>
set end of x to 2 * i
>
set end of x to 401 - 2 * i
>
end repeat
>
---------------------
>
>
OMM quicksort returns a stack overflow error on that list.
I think it may depend on the quicksort implementation. Both Arthur's
original handler and the script that Rick's currently developing can
handle much larger lists than that with ease. They're both "in place"
sorts, rearranging the original list rather than breaking it up and
building a new one from the bits.
NG
_______________________________________________
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.