Like a traveling salesman problem in C

Status
Not open for further replies.

Highlander-SP

Member level 3
Joined
Sep 21, 2005
Messages
64
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,884
Dear friends,

How can I find any way, in C program, when the user entry with an origin point and final point?
The map is in matrix form, when is 1, exist an way from numer line to number colun, as the picture.
I hava begin, anybory can help continuing it?

# include <stdio.h>
main () {
int k, a,b, o, f, M[10][10];
printf("Entry the matrix dimention (k X k)");
scanf("%d", &k);
printf("Type the matrix:\n");
for (a = 0; a < k; a++){
for (b = 0; b < k; b++)
scanf("%d", &M[a]);
}
printf("Entry with the origin point and final point");
scanf("%d",&o);
scanf("%d",&f);

...............
...............
.......
.........................

?
?
if...............
printf("It's possible to do that way");
else.............
printf("It's not possible to do that way");

}
 

hi,
you can search for Bellman floodfill, depth first search, breadth first search to solve this problem.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…