Subject: Re: Is there any ordered list or balanced tree



I don't care the naming style, I care about the functionalities. And it seems Cocoa is weak at supporting sorting-order-keeping data structures at the high level APIs.

However, the reference is valuable. Thank you.
On Mar 28, 2009, at 6:45 PM, Andrew Farmer wrote:

On 28 Mar 09, at 01:25, an00na@xxxxxxxxx wrote:
I can not find any data structure in Cocoa that maintains sorting order of items gradually added in, using the pairwise comparison results, something like the canonical set in C++'s STL that is usually implemented as a balanced tree.

Unlike the C++ and Java standard libraries, which name data structures based on their implementation, Cocoa's data structures are named to describe their intended use - the internal implementation isn't exposed, but you can rest assured that it'll use something appropriate for the application. (Indeed, the internal implementation may change based on the size of the collection.)

Anyways, since you're after an ordered list, what you want here is NSMutableArray. Inserting elements into a sorted array comes up once in a while; here's a recent discussion:

http://www.cocoabuilder.com/archive/message/cocoa/2009/1/16/227937

A ghost writing code with soul @ http://an00na.blogspot.com/.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

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/maillists%40codeha.us

This email sent to maillists@xxxxxxxxx

...



Privacy