Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 5 - Algorithms - Chapter Review Problems - Page 265: 26

Answer

Sequential search: $\approx 3000$ Binary search: $\approx 13$

Work Step by Step

The sequential search is a linear time algorithm, whereas binary search does logarithmic number of operations. In a sequential (linear) search, each element is compared one by one. If the target is equally likely to be anywhere in the list: Average comparisons $=\frac{n+1}{2}$ When $n=6000$, we have: $\frac{6000+1}{2}=3000.5$ In a binary the maximum number of comparisons is: $⌈\log_2 n⌉$ For $n=6000$ we have: $⌈\log_2 6000⌉=13$
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.