0

In a list of 15 entries (city names) if searching for a particular name what is the average number of comparisons using linear search? Worst case it would 15 comparisons and best case it would be 1 comparison. Is the following calculation the average number of comparisons? If not, how do I calculate the average? Thank you.

(15 + 14 +13+ 12 + 11 + 10 + 9 + 8 +7 +6 +5 +4 + 3+ 2+ 1) / 15 = 8

martinbshp
  • 101
  • 1

0 Answers0