Haha - I did a binary search, which only took about two minutes, and required reading maybe 6 posts. There are real-world advantages to being a computer engineer.

EDIT: for those that don't know, a binary search is a great way to find an item in an ordered list. If you've ever played the game where someone picks a number and you try to guess it, getting "higher" and "lower" after each guess, you might know that a binary search is the fastest way to win.

Example:

50
"higher"
75
"lower"
63 (actually 62.5, but you have to round)
"lower"
57
"lower"
54
"higher"
55
"higher"
56

You'll see now that that MUST be it, because it's higher than 55 and lower than 57. This is also the worst case: you never got lucky and guessed it, you got to it by "brute force". If you're searching through N things, a binary search will find it in log base 2 of N, round up. That was 7 for 100 (the guessing game), and for 500 (number of posts), it was 9. Obviously this makes a lot of sense as N gets large: it's only 20 for N=one million!

More info here:
http://en.wikipedia.org/wiki/Binary_search

Last edited by Auto-X Fil; 02/28/06 05:55 PM.

-Philip Maynard '95 Contour [71 STS | Track Whore] '97 Miata [71 ES | Boulevard Pimp] 2006 autocross results