> 1. Building a c++ array of integers with indices to the new sort order
> 2. Precalculate all crucial sort terms (that depend on external data)
> for the objects to be sorted.
> 3. Sort the index array manually (e.g., a shell sort from Numerical
> Recipes in C, pg 244 (my edition))
> 4. Once done, build a new array based on the sorted indices, and free
> any allocated memory

An intermediate step would be to add a sortOrder int attribute to the class,
then when the comparison selector is called, first calculate it if it's not
already set, then use it.

I've done something similar; the sortOrder attribute was actually a string,
but one whose calculation was somewhat expensive--caching the result
dramatically sped up the sort.

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to