I'm a little bit confused about the analysis of binary search. In almost every paper, the writer assumes that the array size $n$ is always $2^k$. Well I truly understand that the time complexity becomes $\log(n)$ (worst case) under this assumption. But what if $n \neq 2^k$?
For example if $n=24$, then we have
5 iterations for 24
4 i. for 12
3 i. for 6
2 i. for 3
1 i. for 1
So how do we get the result $k=\log n$ in this example (I mean of course every similar example whereby $n\neq2^k$)?