• 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: NSDictionary fast search
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDictionary fast search


  • Subject: Re: NSDictionary fast search
  • From: Allan Odgaard <email@hidden>
  • Date: Mon, 9 Feb 2004 23:09:17 +0100

On 7. Feb 2004, at 12:13, Roberto Sobachi wrote:

Which is the fastest method to search a string value of an NSDictionary
in an NSArray?

It really depends... some strategies with different trade-offs (i.e. pre-processing time vs lookup-time):

1) search the array element by element: O(n)
2) sort the array O(n lg n) and use binary search: O(lg n)
3) create a hash-set O(n) and use hashing: O(1) (expected!)

There are other approaches like state-machines and ternary-search trees often used in parsers (to recognize keywords/maintaining symbel-tables).

Give some details about exactly what it is you're doing and we can better answer your questions.
--
Allan * Top-House * DK
http://www.top-house.dk/~aae0030/
_______________________________________________
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: 
 >NSDictionary fast search (From: Roberto Sobachi <email@hidden>)

  • Prev by Date: Drawing an NSProgressIndicator inside a custom view
  • Next by Date: Re: Drawing an NSProgressIndicator inside a custom view
  • Previous by thread: NSDictionary fast search
  • Next by thread: Subclassing NSTextStorage
  • Index(es):
    • Date
    • Thread