Nah ;o) binary search is really really simple - seriously.

(okay, it requires some recursion, but it's not that bad)

essenetially the premis is that you have an ordered set of data, i.e.

1, 2, 3, 4, 5, 6, 7, 8, 9, 10

and instead of starting at the beginning and looping to the end, you
start in the middle and go:
(say we are looking for 7)
1, 2, 3, 4, [5], 6, 7, 8, 9, 10 
Is this 7? No.
Is it greater than 7? No.
Is it less than 7? Yes. Okay, let's search this set in front of this:

6, 7, [8], 9, 10
Is this 7? No.
Is it greater than 7? Yes. Let's search the set behind this:

[6], 7 
Is this 7 no.
Is it less than 7? Yes. Okay, let's search this set in front of this:

[7]
is this 7? Yes. return this.

Sorry for throwing that O(n) in there - still sometimes go back to
what I remember from Algorithms and Data Structures - O(n) is just a
shorthand way to say 'Order n, where n is the number of items in the
set' - basically, you have to do a loop through everything to get what
you want.

As for if Arrays are burdensome - well that just depends on what you
want to do with them, doesn't it ;)

Mark


On 6/3/05, Chad Renando <[EMAIL PROTECTED]> wrote:
> Thanks Mark...
> 
> "quite easily write yourself a quick binary search algorithm"
> 
> you make me chuckle... *chuckle*  I'll get to that right after I whip
> up my CFC for splitting atoms.
> 
> I'll have a look at the java thing.
> 
> Are array's overly bursonsome?  I am putting all my form field
> attributes (name, type, etc) in an array, which will likely end up
> being 3-dimensions.  The information in the array is coming from 3 or
> 4 queries, so either I loop through the queries in the body of the
> page (I think kinda messy) or loop through my single array.  I am not
> adding any looping to create the array.
> 
> Cheers,
> 
> Chad
> who thinks he used up his sigs for the day
-- 
E: [EMAIL PROTECTED]
W: www.compoundtheory.com
ICQ: 3094740

---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to