Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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");

}
 

banh

Advanced Member level 1
Joined
Dec 16, 2004
Messages
458
Helped
17
Reputation
34
Reaction score
5
Trophy points
1,298
Activity points
3,935
hi,
you can search for Bellman floodfill, depth first search, breadth first search to solve this problem.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top