Invitation to Computer Science 8th Edition

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

Chapter 2 - 2.3 - Examples of Algorithmic Problem Solving - Practice Problems - Page 76: 1

Answer

We would need to change Line 1 so that the algorithm would input 1 million numbers and names rather than 10,000. We would need to change Line 3 so that the loop would repeat a maximum of 1 million times rather than a maximum of 10,000. Actually, that is not a lot of change given that the problem is 100 times bigger. We only needed to change two lines. In fact, if the phone book were 1 billion numbers in length, then we would only need to change the same two lines.

Work Step by Step

We would need to change Line 1 so that the algorithm would input 1 million numbers and names rather than 10,000. We would need to change Line 3 so that the loop would repeat a maximum of 1 million times rather than a maximum of 10,000. Actually, that is not a lot of change given that the problem is 100 times bigger. We only needed to change two lines. In fact, if the phone book were 1 billion numbers in length, then we would only need to change the same two lines.
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.