

That helps to move vigorously in early steps, and cautiously in later steps. The search step must be reduced in size while the search process is moving forward and getting close to the final result.


However, the memoization technique with a large number of cities needs a 2^N × 2^N matrix that can not be easily handled in memory. To optimize the DP method, I could have used the memoization technique. That is, the time complexity significantly increases even with a small increment in the number of cities. This number increases to almost 13 seconds (~60 times greater) with 15 cities. TSP with 10 cities can be solved by a DP method in almost 0.2 seconds using intel core i7. To give you a hint of how this time complexity increases, let me share my experiments. The time complexity with the DP method asymptotically equals N² × 2^N where N is the number of cities. However, its time complexity would exponentially increase with the number of cities. The dynamic programming or DP method guarantees finding the best answer to TSP.
