Java program to implement Travelling Sales Person problem using Dynamic programming
import java.util.Scanner; class TSPExp { int weight[][],n,tour[],finalCost; final int INF=1000; TSPExp() { Scanner s=new Scanner(System.in); System.out.println("Enter no. of nodes:=>"); n=s.nextInt(); weight=new int[n][n]; tour=new int[n-1]; for(int i=0;i { for(int j=0;j {…