Re: NSArray lookup, pointer comparison
Re: NSArray lookup, pointer comparison
- Subject: Re: NSArray lookup, pointer comparison
- From: Uli Kusterer <email@hidden>
- Date: Tue, 29 May 2007 23:32:42 +0200
On 29.05.2007, at 19:51, Keith Duncan wrote:
I'm iterating over a tree of objects but instead of iterating the
tree multiple times I decided to iterate the tree once and put the
nodes into an array. This allows me to check for the presence of
various objects quickly, for the purposes of this discussion two
objects are deemed to be equal if a pointer comparison is true.
What kind of a tree is this? Sorted trees (like binary trees, or red/
black trees or whatever) have much better performance than the
typical linear array search, because due to the sorting a well-
balanced tree can eliminate half the nodes each time it decides which
of two branches to go down. So, it might help to eliminate the array
depending on your kind of tree.
If it's a file system, that might not be an option, of course, just
checking...
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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