Invitation to Computer Science 8th Edition

Published by Cengage Learning
ISBN 10: 1337561916
ISBN 13: 978-1-33756-191-4

Chapter 3 - Exercises - Page 140: 5c

Answer

Both discovered expressions are the same: $\left[\frac{n+1}{2}\right]$. This means that it can be used to calculate the average number of comparisons.

Work Step by Step

The expressions that we discovered in parts (a) and (b) are one and the same. Since we have analyzed both possibilities for $n,$ even and odd, we can say that our expression is the one we can use to calculate the average number of comparisons using sequential search in an n-element list. $\frac{n+1}{2}$
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.