#include #include #include #include #include typedef struct { double x; double y; } point; double sqr(double x) { return x*x; } double dist(point cities[], int i, int j) { return sqrt(sqr(cities[i].x-cities[j].x)+ sqr(cities[i].y-cities[j].y)); } void tsp(point cities[], int tour[], int ncities) { int i,j; char *visited = alloca(ncities); int ThisPt, ClosePt=0; double CloseDist; int endtour=0; for (i=0; i", argv[0]); exit(1); } ncities = atoi(argv[1]); cities = alloca(ncities*sizeof(point)); tour = alloca(ncities*sizeof(int)); for (i=0; i