can i use a binary search if the value i am searching for is not 
explicitly in my arraycollection? i want to get the closest value to 
the timestamp i am searching for.



--- In [email protected], "Michael VanDaniker" <[EMAIL PROTECTED]> 
wrote:
>
> If your collection is sorted by timestamp a binary search would be 
faster.
> 
> --- In [email protected], "Alex Harui" <aharui@> wrote:
> >
> > You'll have to loop through yourself and keep track of the minimum
> > difference
> > 
> >  
> > 
> > ________________________________
> > 
> > From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> > Behalf Of blc187
> > Sent: Wednesday, August 13, 2008 12:57 PM
> > To: [email protected]
> > Subject: [flexcoders] how to search an arraycollection
> > 
> >  
> > 
> > I have an arraycollection of objects, each of which has a 
timestamp.
> > ex: {timestamp:4342423432, value:5}
> > 
> > I want to search the arraycollection for the object which has the 
> > closest timestamp to the time I'm looking for.
> > Is there a way to search the arraycollection for an approximate 
value?
> > 
> > As of right now I'm looping through each object in my 
arraycollection 
> > to find if the value is between 2 numbers.
> > 
> > for(var i:int = 0; i < dataProvider.length; i++) {
> > if(myTimestamp > dataProvider[i] && myTimestamp < dataProvider
[i+1])
> > //this is the correct spot.
> > }
> >
>


Reply via email to