I believe the point you're missing is that a binary search divides the answer set, not the problem set.
Who says ? Sounds like a statement that you just made up.
I disprove your statement with an example.
To perform a binary search of say the telephone directory, I open it to the middle and see if the name I am searching for is <= or > that position. Then I search that half etc.
This is an example of a binary search. It is dividing the problem set, not the answer set.
Here 'n' is the number of entries in the directory and the search is O(log n).
Compare this to the rather ridiculous prospect of searching the telephone directory entry by entry from the beginning to the point where you find a match. That would be the 'linear' search approach and performance would be O(n).
Now change the telephone directory to the set of possible input numbers to our function.
In the correct interpretation, 'n' is the number of possible numbers - lets say it is 2^32 although this isn't really correct as the valid range is really 2^30 once you take out negative numbers and those > 2^30 for which the answer 2^31 wraps around in a signed integer.
All of my examples are O(log n) or better.
NextPowerV4() appears to do considerably better. As does Floyd's NextPowerOfTwo(). It is possible to do better than O(log n) because of course this isn't a general search but something open to calculation.
Both of these routines achieve something like O(log(log n)) for best, worst and average cases which is quite impressive.
I stand by my statement about NextPowerV5() that "If the input numbers are uniformly distributed over 0 - 2^30 then the best tree would be:". To be perfectly correct I should have said "If the input numbers are uniformly distributed over 0 - 2^30 then the best tree for the best and average case would be:".
In fact for the average case, NextPowerV5() performance is constant time - O(1) and that beats both O(log n) and O(log(log n)). If you don't get that I'd be happy to prove it.
You might argue that 'n' should refer to the number of bits of the function argument. By doing so you've already applied the log function. If that is your interpretation then I'd encourage you to use 'n' in the conventional way.
For a function F with input p we write F(p) and discuss its performance in terms of being O(1), O(n), O(log n), O(n^2) etc with 'n' being the number of possible values of 'p'. For simplicity you can do away with p and just talk about F(n) performance being O(n) etc.
As an aside - It would be possible but of course ridiculous to try to implement the function as a linear search with O(n) performance.
If we don't know the distribution, it's better to go for a better worst case scenario.
Another bold statement. It depends on what you want to optimise, the average case or the worst case. What you are stating is that if you don't know the input distribution you should optimise for the worst case. Well maybe not. Maybe you should optimise the average performance. It depends upon the application.
Going back to the original question by big10p we do have an idea about the input distribution - "... given a random integer value ...".