Invitation to Computer Science 8th Edition

$$N_{m}=\frac{n-1}{2}+1=\frac{n-1+2}{2}=\frac{n+1}{2}$$
We suppose we have an odd number of items, like $15 .$ Our task is to find the position for the middle item. Here's how we can find the position for a 15 -element list: $15=14+1=2 \cdot 7+1=7+1+7$ Here we can see that we have one single element in the middle because it is an odd number and odd numbers can be written in the form $2 \cdot m+1 .$ It is obvious that the middle element is the $8^{t h}$ element which has 7 elements before and 7 after it. We can do the same to a couple of other odd numbers: $\quad \quad \bullet 23=2 \cdot 11+1,$ with $12^{t h}$ as the middle element $\quad \quad \bullet 75=2 \cdot 37+1,$ with $38^{t h}$ as the middle element The number of comparisons required to find the middle item for each of the above lists is equal to the middle's position: $8,12,38 .$ We can write an expression to find this middle item $N_{m}$ in a $n$ -element list, where $n$ is odd: $N_{m}=\frac{n-1}{2}+1=\frac{n-1+2}{2}=\frac{n+1}{2}$