Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Where is NSList?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is NSList?



On Jul 28, 2004, at 2:48 AM, Pandaa wrote:
ToThere is no NSLinkedList. What would the point of such an object be? There's already one ordered collection, NSArray.

Ordered and indexed. A list is ordered and non-indexed. An array has O(n) insert and remove and O(1) indexed random access. A list has O(1) insert and remove and O(n) indexed random access.

Actually, any ordered collection should also be indexable. That's what ordering gets you. A List is-a OrderedCollection and an Array is-a OrderedCollection. The only difference is in their performance characteristics for insert, remove, and random access.

I'd suggest using NSArray/NSMutableArray for ordered collections, and only worrying about their access characteristics if use and profiling of your application point to them as a performance issue.

This is a *very* naive view which may well lead to O(n^2) or worse implementations of O(1) problems!

Actually, it's a pragmatic view. Don't spend your time optimizing something until you actually know it needs to be optimized. That use of a list instead of an array for some small piece might not make as much difference to the performance of your application as using OpenGL will (for example).

-- Chris
_______________________________________________
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.


References: 
 >Where is NSList? (From: Tim Conkling <email@hidden>)
 >Re: Where is NSList? (From: Shawn Erickson <email@hidden>)
 >Re: Where is NSList? (From: Tim Conkling <email@hidden>)
 >Re: Where is NSList? (From: Steve Checkoway <email@hidden>)
 >Re: Where is NSList? (From: Tim Conkling <email@hidden>)
 >Re: Where is NSList? (From: Dustin Voss <email@hidden>)
 >Re: Where is NSList? (From: Steve Checkoway <email@hidden>)
 >Re: Where is NSList? (From: Pandaa <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.