I once got the following as an interview question:
I\'m thinking of a positive integer n. Come up with an algorithm that can guess it in O(lg n) quer
You can sort rational numbers in a given interval by for example the pair (denominator, numerator). Then to play the game you can
[0, N] using the doubling-step approach[a, b] shoot for the rational with smallest denominator in the interval that is the closest to the center of the intervalthis is however probably still O(log(num/den) + den) (not sure and it's too early in the morning here to make me think clearly ;-) )