• 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: Where is NSList?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is NSList?


  • Subject: Re: Where is NSList?
  • From: Chris Hanson <email@hidden>
  • Date: Wed, 28 Jul 2004 12:18:30 -0700

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>)

  • Prev by Date: Re: Binding window title
  • Next by Date: Re: Where is NSList?
  • Previous by thread: Re: Where is NSList?
  • Next by thread: Re: Where is NSList?
  • Index(es):
    • Date
    • Thread