• 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: Is there any ordered list or balanced tree
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there any ordered list or balanced tree


  • Subject: Re: Is there any ordered list or balanced tree
  • From: Dave DeLong <email@hidden>
  • Date: Sat, 28 Mar 2009 07:26:16 -0600

A guy in our CocoaHeads group (Quinn Taylor, works at Apple), adopted the old abandoned DataStructures framework by Phillip Morelock and has given it new life. You can checkout the source from our SVN repository here:

http://cocoaheads.byu.edu/code/CHDataStructures

I must say, Quinn has put a TON of effort into this. He's got a wide variety of data structures, such as singly linked list, doubly linked list, Andersson trees, AVL trees, Red-Black trees, Treaps, Unbalanced trees, double-ended queues, regular queues, stacks, and a bunch more. It's written for Leopard, supports fast enumeration, and even plays nice in a GC environment.

I think the only "odd" thing about it is that you have to switch your C dialect to GNU99 instead of the default C99, since C99 doesn't support anonymous structs and unions.

Either way, it's an excellently written framework, with a full sweet of unit tests, etc.

I encourage you to check it out.

Cheers,

Dave

On Mar 28, 2009, at 7:15 AM, email@hidden wrote:

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, email@hidden 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 (email@hidden)

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:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Is there any ordered list or balanced tree (From: email@hidden)
 >Re: Is there any ordered list or balanced tree (From: Andrew Farmer <email@hidden>)
 >Re: Is there any ordered list or balanced tree (From: email@hidden)

  • Prev by Date: Re: Is there any ordered list or balanced tree
  • Next by Date: Re: Is there any ordered list or balanced tree
  • Previous by thread: Re: Is there any ordered list or balanced tree
  • Next by thread: Re: Is there any ordered list or balanced tree
  • Index(es):
    • Date
    • Thread