Traveling Salesperson problem:
Given n cities, a salesperson starts at a specified city (source), visit all n-1 cities only once and return tio the the city from where he has started. The objective of this problem is to find a route through the cities that minimizes the cost and thereby maximizing the profit.
#include
int s,c[100][100],ver;
float optimum=999,sum;
/* function to swap array elements */
void swap(int v[], int i, int j)
{
int t;
t = v[i];
v[i] = v[j];
v[j] = t;
}
/* recursive function to generate permutations */
void brute_force(int v[], int n, int i)
{
// this function generates the permutations of the array from element i to element n-1
int j,sum1,k;
//if we are at the end of the array, we have one permutation
if (i == n)
{
if(v[0]==s)
{
for (j=0; j
