Consider the following algorithm for solving the TSP:
$n$ = number of cities
$m$ = $n\times n$ matrix of distances between cities
min = (infinity)
for all possible tours, do: find the length of the tour if length < min min = length store tour
What is the complexity of this algorithm in terms of $n$(the number of cities)? You may assume that matrix lookup is $O(1)$, and that the body of the if-statement is also $O(1)$. You need not count the if-statement or the for-loop guard(ie. conditional)checks, etc., or any of the initializations at the start of the algorithm.
I think the time complexity is $n!$, as the number of cities is $n$, the for-loop in the algorithm above check for all the possible permutations of the distances between the cities. Did I understand the algorithm correctly? Any help or hints would be greatly appreciated.