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:56:13 +0200
Le 16 avr. 08 à 04:14, Michael Ash a écrit :
On Tue, Apr 15, 2008 at 5:38 PM, Jean-Daniel Dupas
<email@hidden> wrote:
If you need a storage that provide binary search, you can probably
use a
CFBinaryHeap.
"CFBinaryHeap implements a container that stores values sorted
using a
binary search algorithm. All binary heaps are mutable; there is not a
separate immutable variety".
Despite the name, CFBinaryHeap does not provide any binary search
facilities.
It is a priority queue, heap being another name for that. In other
words, it's an object where you can put things into it in any order,
but when you get an object from it that object is always the smallest
one in the container, and it's implemented so that this is very fast,
O(log n).
I can see ways to use this object to implement this sort of histogram,
but it doesn't let you specify an input value and get an index to the
closest match.
Mike
Sorry, I was abused by the class description.
So I think the closer way to do it using built-in function is using
CFArray (NSArray free bridged) and the CFArrayBSearchValues() function.
But it look like it does not really returns the closest match, but the
index of the value greater than the target value (if exact value not
found).
_______________________________________________
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