Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 16th, 2005, 7:11 PM   #1
tuthjaa
Newbie
 
Join Date: Feb 2005
Posts: 1
Rep Power: 0 tuthjaa is on a distinguished road
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
tuthjaa is offline   Reply With Quote
Old Feb 16th, 2005, 8:17 PM   #2
Dizzutch
Professional Programmer
 
Dizzutch's Avatar
 
Join Date: Dec 2004
Location: Worcester, MA
Posts: 441
Rep Power: 4 Dizzutch is on a distinguished road
Send a message via ICQ to Dizzutch Send a message via AIM to Dizzutch Send a message via MSN to Dizzutch Send a message via Yahoo to Dizzutch
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
__________________
naked pictures of you | PFO F@H stats
Dizzutch is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:55 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC