RE: [Flashcoders] Doing a binary search in AS3?

2010-05-06 Thread Merrill, Jason
M To: Flash Coders List Subject: Re: [Flashcoders] Doing a binary search in AS3? Hi Jason, the complexity probably isnt that hard. You have s, you look at wordlist[wordlist.length/2], you find a g, so clearly you have to repeat that for the upper half of the list etc. Dictionary is not going to work

Re: [Flashcoders] Doing a binary search in AS3?

2010-05-06 Thread Hans Wichman
g > (note: these are for Bank of America employees only) > > > > > > > -Original Message- > From: flashcoders-boun...@chattyfig.figleaf.com > [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Hans > Wichman > Sent: Thursday, May 06, 2010 11:

RE: [Flashcoders] Doing a binary search in AS3?

2010-05-06 Thread Merrill, Jason
nk of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Hans Wichman Sent: Thursday, May 06, 2010 11:06 AM To: Flash Coders List Subject: Re: [Flashcoders] Doing a binary search in A

Re: [Flashcoders] Doing a binary search in AS3?

2010-05-06 Thread Henrik Andersson
Merrill, Jason wrote: Just compare the middle element, if it is bigger, use the left half, else use the right half. I don't follow - can you post an Actionscript example? //warning, not fully correct, will infinity loop while(lefthttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] Doing a binary search in AS3?

2010-05-06 Thread Hans Wichman
the most important thing being as Hendrik said that it is sorted, which in your example it is not. Say you have: ["apple", "banana", "cherry", "kiwi", "orange", "peach" "pear", "pineapple", ] and you are looking for banana: middle element is orange (or kiwi) take "apple", "banana", "cherry", "kiw

RE: [Flashcoders] Doing a binary search in AS3?

2010-05-06 Thread Merrill, Jason
010 10:45 AM To: Flash Coders List Subject: Re: [Flashcoders] Doing a binary search in AS3? Merrill, Jason wrote: > I understand what a binary search algorithm is, but am wondering how > that could be implemented on an array in Actionscript (if at all) > without using methods that would

Re: [Flashcoders] Doing a binary search in AS3?

2010-05-06 Thread Henrik Andersson
Merrill, Jason wrote: I understand what a binary search algorithm is, but am wondering how that could be implemented on an array in Actionscript (if at all) without using methods that would defeating the purpose of a binary search (speed). Anyone have experience in this area? So for example, if

[Flashcoders] Doing a binary search in AS3?

2010-05-06 Thread Merrill, Jason
I understand what a binary search algorithm is, but am wondering how that could be implemented on an array in Actionscript (if at all) without using methods that would defeating the purpose of a binary search (speed). Anyone have experience in this area? So for example, if you have a list like th