## Invitation to Computer Science 8th Edition

First, we search for Sherman in the list. Since it's the first element of the list, it takes just one comparison to get to it. To find Jane we perform 2 comparisons. To find Ted, which is the third on the list, we need 3 comparisons. It's easy to notice that for each n-th name we need n comparisons. The average of the comparisons is the sum $1+2+3+4+5+6+7$ divided by $7 .$ We can use the formula $\frac{n *(n+1)}{2}$ for the sum. Dividing the sum by $n$ (7 in our case) gives us $\frac{n+1}{2},$ in our case $\frac{7+1}{2}=4$ We have reached the expression that we have used previously $\frac{n+1}{2}$