Searching, Sorting & Selection

Your answer
Answer & solution
Answer: D: (n+1)/2 (no official key was published)
If the item occupies position i, searching from the beginning requires i comparisons. Uniform success positions therefore give E[C]=(1+2+…+n)/n. The arithmetic-series sum is n(n+1)/2, so E[C]=(n+1)/2. This is not the unsuccessful-search cost n, because successful searches stop at their target. Nor is it a binary-search logarithm, since the stated algorithm scans sequentially rather than repeatedly halving a sorted range.