Invitation to Computer Science 8th Edition

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

Chapter 1 - Exercises - Page 40: 11

Answer

It would have to analyze all possible permutations of the 25 cities. That would mean $25 !$ possible paths. This is a total of 1.551121$\cdot 10^{25}$ paths. By analyzing $10,000,000$ paths per second our computer would need 1.551121. $10^{18}$ seconds, which is around $49,185,724,100$ years. This is a famous problem in computer science called the Travelling Salesperson. Scientists are still trying to come up with more and more efficient algorithms.

Work Step by Step

By using the algorithm designed by the salesperson, which is to list all possible ways to visit the 25 cities it would have to analyze all possible permutations of the 25 cities. That would mean $25 !$ possible paths. This is a total of 1.551121$\cdot 10^{25}$ path. By analyzing $10,000,000$ paths per second our computer would need 1.551121$\cdot 10^{18}$ seconds, which is around $49,185,724,100$ years. This is obviously not a very efficient algorithm for our task, given the number of cities that we have to analyze. A possible way to go about it would be to start with the two closest cities.
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.