views:

228

answers:

1

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
+1 Very cool :) I was actually looking for some mathematical reprentation for it. How can you get it with computer?
Masi
You'll have to learn some graph theory :) The algorithms are explained in the two pages I linked to.
marcog
marcog: Great thanks! I will :)
Masi