• 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: a mild sorting annoyance?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a mild sorting annoyance?


  • Subject: Re: a mild sorting annoyance?
  • From: Ondra Cada <email@hidden>
  • Date: Tue, 19 Nov 2002 14:17:37 +0100

On Tuesday, Nov 19, 2002, at 03:53 Europe/Prague, John C. Randolph wrote:

I wouldn't call it a bug. If you return NSOrderedSame, I'd say it's fair to insert the two elements in question in either order. It sounds like in your situation, they're not *really* the same. For the example you give, your compare method should check both criteria.

It's a bit more subtle. Programmer's POV of course there's no real difference: you either sort by more keys or not, and save some (generally negligible) performance gain, stable or non-stable sorting, all the same.

The advantage of stable sorting algorithm comes from the user's POV: you don't need to have any GUI for multi-key sorting, and *still* you can, effectively, do that. Of course again this *can* be achieved programmatically, but the vast advantage of a stable NSArray sorting would the that it would just work for any app, regardless its programmer even considered it or not.

That's why I think a feature request might be a right way (of course, a bug report would be out of order -- there's no bug, we are speaking of a possible feature to be added). Also, I am not *that* an expert of sorting algorithms: although I am quite positive there is a stable sorting algorithm which won't be slower than anything which is actually used (qsort?), I might be wrong there.

If there is no stable algorithm quick enough, it might be best if it was externally settable by a default, something like com.apple.stableArraySortingAlgorithm NO/YES.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • more on stable sorting...
      • From: Steve Mykytyn <email@hidden>
References: 
 >Re: a mild sorting annoyance? (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: OS X on AMD Hammer rumors?
  • Next by Date: Re: Is Objective-C loaded?
  • Previous by thread: Re: a mild sorting annoyance?
  • Next by thread: more on stable sorting...
  • Index(es):
    • Date
    • Thread