Consider the set of strings S that contains the binary representation of the numbers 0 to 99. What is the shortest string T such that every element of S is a substring of T?
+2
A:
What you're asking for is very similar to the binary De Bruijn sequence. The algorithm for that problem, which uses Eulerian cycles, can easily be adapted to solve your problem.
marcog
2009-05-04 05:42:14
+1 Very cool :) I was actually looking for some mathematical reprentation for it. How can you get it with computer?
Masi
2009-05-04 05:52:13
You'll have to learn some graph theory :) The algorithms are explained in the two pages I linked to.
marcog
2009-05-04 05:58:45
marcog: Great thanks! I will :)
Masi
2009-05-04 06:00:14