Re: binary search trees & binning
Re: binary search trees & binning
- Subject: Re: binary search trees & binning
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 16 Apr 2008 09:59:59 +0200
Le 16 avr. 08 à 00:07, John Stiles a écrit :
Hmm, set<double> sounds a lot easier than this to me.
Just use insert to put all the doubles into the set (one line), then
use lower_bound to find the delineations between each group (another
one-liner, though of course you'll need to loop over the number of
groups you want). Then the distance between iterators is the size of
each group (std::distance can compute this in another one-liner).
Unfortunately this is another case where Cocoa's collection classes
just aren't very strong, but STL is made for this sort of work...
though Jens is probably right that performance isn't going to be a
big problem if it's <10000 items. The set<> will be a whole lot
faster, but any naive implementation will be "fast enough" unless
you expect your data set will eventually be a lot larger than this.
Do not make assumptions on "CFArray vs STL vectors" performances,
especially for big arrays.
CFArray has some optimizations that made it really fast for some
usages. (http://ridiculousfish.com/blog/archives/2005/12/23/array/).
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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