in reply to Re: Generic De Bruijn Sequence
in thread Generic De Bruijn Sequence
De Bruijn is supposed to be cyclic AAACCCBCCACBBCBACABCAABBBABAA
Yes. The last $n-1 chars overlap with the beginning. The debug prints show each permutation lined up with the output string, so you can see how the graph is traversed and the output constructed. I could have just used the last char of each permutation, and had a true De Bruijn output, but that didn't suit my needs.
I found the Python code, but didn't like it because of the lack of explanation. To understand it, I have to trace code that does a lot of index math, instead of reading comments hinting at an algorithm that makes sense on a higher level. It's not far removed from pointer math and assembler code, so it doesn't seem very Pythonic, as they like to say.
If nothing else, my code at least tries to say what it's doing. So the next guy can try to understand it, and not blindly accept it, nor need to walk through on paper to believe that it's correct.
-QM
--
Quantum Mechanics: The dreams stuff is made of
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Generic De Bruijn Sequence (updated)
by LanX (Saint) on Apr 19, 2017 at 23:16 UTC | |
by QM (Parson) on Apr 26, 2017 at 09:57 UTC | |
|
Re^3: Generic De Bruijn Sequence
by LanX (Saint) on Apr 19, 2017 at 23:47 UTC |