The average number of key comparisons required for a successful search for sequential search on items is
View worked solution
Answer: C
For a successful sequential (linear) search on items, the target element must be present in the list. Let us assume that the element is equally likely to be at any of the positions (uniform probability distribution).
- If the element is at the position, it requires comparison.
- If the element is at the position, it requires comparisons.
- If the element is at the position, it requires comparisons.
- If the element is at the position, it requires comparisons.
Since each position has an equal probability of , the average (expected) number of key comparisons is given by:
Using the sum of the first natural numbers, :
Hence, the correct option is C.
Free practice · Your answers on this page are not saved.
