We play a variant of the classical number guessing game. The rules is as follows:
- There are two integers $a,b$ to be guessed. It is guaranteed that $1\leq a < b \leq n$.
- Each round I can guess an integer $p$. The possible responses are:
- $p<a$
- $a=p$
- $a<p<b$
- $p=b$
- $b<p$
How can I pick $p$ each round so that I can guess both $a$ and $b$ correctly in fewest rounds?
I would guess that using a binary search algorithm would guarantee the fastest result. First select the integer part of the midpoint number $\frac{n}{2}$. If a is below this, then select the midpoint of the bottom half. Continue selecting the midpoint of the section that a is forced into, until a is found. Then repeat with the upper half to find b.