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(left<right) {
var middle=(left+right)/2;
var value=arr[middle];
if(value<needle) {
right=middle;
} else {
left=middle;
}
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders