GithubHelp home page GithubHelp logo

debruijn's Introduction

DeBruijn

/r/dailyprogrammer 274 Intermediate - Generating DeBruijn Sequences

"In combinatorial mathematics, a De Bruijn sequence of order n on a size-k alphabet A is a cyclic sequence in which every possible length-n string on A occurs exactly once as a substring."

i.e. DeBruijn(2,3) has alphabet {1,0} and contains every 3 length substring possible when the ends are attached

DeBruijn(2,3) = 11101000

I used the Duval Algorithm to generate Lyndon words:

If w is one of the words in the sequence, then the next word after w can be found by the following steps:

1.Repeat the symbols from w to form a new word x of length exactly n, where the ith symbol of x is the same as the symbol at position (i mod length(w)) of w.
2.As long as the final symbol of x is the last symbol in the sorted ordering of the alphabet, remove it, producing a shorter word.
3.Replace the final remaining symbol of x by its successor in the sorted ordering of the alphabet.

ref. https://en.wikipedia.org/wiki/Lyndon_word https://en.wikipedia.org/wiki/De_Bruijn_sequence

debruijn's People

Contributors

sircinnamon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.