Skip to content

Instantly share code, notes, and snippets.

jgcoded / traveling_salesman.cpp
Created Oct 12, 2015
Traveling Salesman solution in c++ - dynamic programming solution with O(n * 2^n).
View traveling_salesman.cpp
#include <vector>
#include <iostream>
using namespace std;
\brief Given a complete, undirected, weighted graph in the form of an adjacency matrix,
returns the smallest tour that visits all nodes and starts and ends at the same
node. This dynamic programming solution runs in O(n * 2^n).