From state , try going to any unvisited city . Check if next is unvisited: .
If so, transition to with added cost . Process masks in increasing order. Smaller subsets (fewer bits set) must be computed before larger ones, since you build up by adding cities.
This topological order keeps dependencies are satisfied. For each mask, try all possible last cities and all possible next cities. That's work per mask, giving total.