Let S be a set of ten-digit numbers. For any two numbers v and w in S , I would like to know if there is a sequence of numbers v = u_0, u_1, ..., u_k = w such that:
- every u_i is in S
- for each i = 1, ..., k, the numbers u_ {i-1} and u_i differ in exactly one position
As a plus, it would be even better to find an algorithm for finding the shortest such sequence.
Ideally, I would prefer a solution to C (or pseudo-code), but I really really appreciate any suggestions on this! Thanks!
source share