Proposition: The binary search algorithm runs in $O(\log n)$ time for a sorted sequence with $n$ elements.
When justifying this claim, first we say that with each recursive call the number of candidate entries still to be searched is given by the value $$ high - low + 1 $$
The middle index, $mid$, is given by $$ mid = \Biggl\lfloor\frac{high + low}2\Biggr\rfloor $$
We say that the number of remaining candidates is reduced by at least one half with each recursive call. Hence the number of remaining candidates, $n$, when we shift our $high$ index to the $(mid - 1)$ index is given by:
$$ n = (mid - 1) - low + 1 $$ $$ n = \Biggl\lfloor\frac{high + low}2\Biggr\rfloor - 1 - low + 1 $$ $$ n = \Biggl\lfloor\frac{high + low}2\Biggr\rfloor - low $$ $$ n \le \Biggl\lfloor\frac{high -low + 1}2\Biggr\rfloor $$ This is the part I don't understand how did we get from the equality equation to the inequality equation?
Again, when we are computing the maximum number of recursive calls performed, $r$, we say that $r$ is the smallest integer such that
$$ \frac{n}{2^r} < 1 $$ So: $$ r > \log n $$ $$ r = \lfloor \log n \rfloor + 1 $$
Similarly, how did we get from the inequality equation to the equality equation?
Any help will be appreciated to help me understand this proof.