Traveling Salesman in polynomial time
Posted
by Andres
on Stack Overflow
See other posts from Stack Overflow
or by Andres
Published on 2010-04-01T17:33:54Z
Indexed on
2010/04/01
17:43 UTC
Read the original article
Hit count: 664
Problem Description:
Write a program in any language with the shortest number of characters that solves the following problem:
Given a collection of cities and the cost of travel between each pair of them, find the cheapest way of visiting all of the cities and returning to your starting point. All solutions must take at most polynomial time.
Input will be in the form of a text file named simply "i". The text file will contain data in the following format:
city1# city2# cost$
cityA# cityB# cost$
...
Each element in the file is separated with a space, and there is a newline at the end of every line.
Code count does not include whitespace.
Solutions that take longer than polynomial time to find will not be accepted
© Stack Overflow or respective owner