I have read from multiple sources and from my understanding of the algorithm that it runs in 2^N time. My question is what causes TSP to achieve this run time? I can’t seem to find a pseudo-code so i can examine it.
I have read from multiple sources and from my understanding of the algorithm that
Share
The algorithm you mean is likely the inclusion-exclusion:
Find the shortest path though the following state space using
A*:The time complexity of inclusion-exclusion is given by the number of states: there is exactly one ‘current’ city (factor of
n) and all other cities are either visited or unvisited (factor of2^n).The ‘A*’ algorithm will enter each state at most once. For each state, it will explore at most ‘n’ other nodes and push them into the priority queue. The priority queue will take at most ‘O(n)’ time to perform its operation.
Thus, the running time is
O(2^n * n * n * O(n))=O(2^n * poly(n)). Further insight shows thatO(2^n * poly(n))is equal toO(2^n).