![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2005
Posts: 1
Rep Power: 0
![]() |
Recursive algorithm - combinations
Hi,
Hi, I am working on a simple route finder and trying to workout a inplementation of the classic traveling salesman problems. I have an array of postcodes (about 5-10 of them ) and need to work out every possible combination of ordering them. Does anyone know how to make a combination generator in php? I understand that it has to be recursive - but don't know where to start solving the problem. does anyone have any ideas? Thanks, James |
|
|
|
|
|
#2 |
|
Professional Programmer
|
1) draw out steps on paper
2) write pseudo code 3) code it for every zip code generate a tree that has a branch to any other zip code, and from that node to any remaining one etc. 1 2 3 4 1 | | 2 3 4 | | | | | | 3 4 2 4 2 3 | | | | | | 4 3 4 2 3 2 etc. you get my drift, i hope good luck Dizz |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|