On Nov 28, 2012, at 13:02 , Quincey Morris <[email protected]> wrote:
> I think the loop algorithm needs to look like this: > > C1. Loop over the "less than" set starting from its highest index and working > down. At each iteration, move the row at the current index to 'targetIndex - > 1'. (But don't decrement targetIndex here.) > > C2. Loop over the "greater than" set starting from its lowest index and > working up. At each iteration, move the row at the current index to the > targetIndex row, and increment targetIndex. Ugh, I think I made the same mistake again. The decrement has to be there: C1. Loop over the "less than" set starting from its highest index and working down. At each iteration, move the row at the current index to 'targetIndex - 1' and decrement targetIndex. C2. Reset targetIndex to its original value. C3. Loop over the "greater than" set starting from its lowest index and working up. At each iteration, move the row at the current index to 'targetIndex', and increment targetIndex. _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
