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 - Section 5.5 - Recursive Structures - Questions & Exercises - Page 253: 2

Answer

For $200$ entries: $8$ comparisons For $100,000$ entries: $17$ comparisons

Work Step by Step

Binary search works by repeatedly dividing the search interval in half. The maximum number of entries that must be checked is equal to the ceiling of the base-2 logarithm of the number of entries: Max comparisons $=⌈\log_2(n)⌉$ For $200$ entries we have: $\log_2(200)\approx 7.64$ $⌈7.648⌉=8$ For $100,000$ entries we have: $\log_2(100,000)\approx 16.61$ $⌈16.61⌉=17$
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.