• 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: storing numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: storing numbers


  • Subject: Re: storing numbers
  • From: Ken Turkowski <email@hidden>
  • Date: Mon, 24 Jan 2005 15:40:24 -0800

On Jan 23, 2005, at 01:51, Pierre Chatel wrote:

i need to store a large amount of integers (most of them are
contiguous (e.g 1,2,3,4,5...), some are not; they can also be sorted),
and to do *quick* research on that numbers (like: is that number a
member of this "array"). Do u have a suggestion on the data type i
should use ? NSArray is waaaaay to slow for quick searching.

You need a tree of some sort to reduce the search from O(n) to O(log(n)).


Have you tried bsearch()?

--
Ken Turkowski                    email@hidden
Engineer/Scientist   http://www.worldserver.com/turk/
Independent Consultant      Industrial Grade Software
Computer Graphics     2D     3D     Immersive Imagery
Photo-mosaicing       Panoramas       Computer Vision
Applied Mathematics  Numerical Analysis  Optimization

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Database
  • Next by Date: Re: storing numbers
  • Previous by thread: Re: storing numbers
  • Next by thread: Re: storing numbers
  • Index(es):
    • Date
    • Thread