j*********g 发帖数: 36 | 3 This is not gray code. No need to formulate it as TSP. Also, debrujin
graph only gives you a problem formulation.
You can solve by finding an Eulerian tour. Each node is a 3-digit number eg
100, and two nodes 100 and 001 are adjacent if they can be combined into
1001. Now every node has equal in-degree and out-degree, thus an Eulerien
tour exists and can be found using the standard algorithm. |
|