## Invitation to Computer Science 8th Edition

Published by Cengage Learning

# Chapter 3 - 3.4 - Analysis of Algorithms - Practice Problems - Page 129: 3

#### Answer

If the data file is sorted numerically by $SSN$, then the binary search algorithm can be used. The worst case is 29 ($2^{28}$ = $268,435,456$ and $2^{29}$ = $536,870,912$). If the data file is sorted alphabetically by the individual’s last name, then as far as searching for an $SSN$ is concerned, the file is unsorted. The sequential search algorithm must be used, with the worst case of $453,700,000.$

#### Work Step by Step

If the data file is sorted numerically by $SSN$, then the binary search algorithm can be used. The worst case is 29 ($2^{28}$ = $268,435,456$ and $2^{29}$ = $536,870,912$). If the data file is sorted alphabetically by the individual’s last name, then as far as searching for an $SSN$ is concerned, the file is unsorted. The sequential search algorithm must be used, with the worst case of $453,700,000.$

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.