generate De Bruijn sequence memory and string vs lists

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Jan 24 03:29:18 EST 2014


Vincent Davis wrote:
> I plan to use the sequence as an index to count occurrences of sequences 
> of length n.

If all you want is a mapping between a sequence of
length n and compact representation of it, there's
a much simpler way: just convert it to a base-k
integer, where k is the size of the alphabet.

The resulting integer won't be any larger than an
index into the de Bruijn sequence would be, and
you can easily recover the original sequence from
its encoding without needing any kind of lookup
table.

-- 
Greg



More information about the Python-list mailing list