Order for binary searches

Wayne E Baisley wbaisley@enspherics.com
Mon, 12 Nov 2001 21:32:24 -0600


> I think you're still stuck with O (log2 (t)).

As an example, suppose you have 511 ones and 513 zeros.  You end up
making 10 (ie, log2 (1024)) tests to find that out, just as you would
for n=0 or n=1024.  You only gain as n is close to one of the binary
nodes like t/2, t/4, 3t/4, t/8, 3t/8, 5t/8, 7t/8, etc.  It's slightly
messier when t is not a power of 2.

Cheers,
Wayne

An' here I sit so patiently
Waiting to find out what price
You have to pay to get out of
Going through all these things twice.