## Invitation to Computer Science 8th Edition

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.
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.