I know this is a dupe but can't quite describe it correctly for the search.
What's it called when you can cover all combinations of a set by sequentially entering numbers?
For example, consider the set {1,2,3,4,5} and I want开发者_Python百科 to cover all the 3-digit combinations with a minimal number moves.
1,2,3,4,5,1,3,2 ... would cover {1,2,3}, {2,3,4}, {3,4,5}, {4,5,1}, {5,1,3}, {1,3,2}, etc.
It's called a De Bruijn sequence.
Permutations without repetitions
http://en.wikipedia.org/wiki/Permutation
I would call it a (5,3) gray code.
精彩评论