Efficient Ranking of Lyndon Words and Decoding Lexicographically Minimal de Bruijn Sequence

We give efficient algorithms for ranking Lyndon words of length $n$ over an alphabet of size $\sigma$. The rank of a Lyndon word is its position in the sequence of lexicographically ordered Lyndon words of the same length. The outputs are integers of exponential size, and complexity of arithmetic operations on such large integers cannot be ignored. Our model of computations is the word RAM, in which basic arithmetic operations on (large) numbers of size at most $\sigma^n$ take $\mathcal{O}(n)$ time. Our algorithm for ranking Lyndon words makes $O(n^2)$ arithmetic operations (this would imply directly cubic time on word RAM). However, using an algebraic approach we are able to reduce the total time complexity on word RAM to $O(n^2 \log\sigma)$. We also present an $O(n^3 \log^2 \sigma)$-time algorithm that generates the Lyndon word of a given length and rank in lexicographic order. Finally we use the connections between Lyndon words and lexicographically minimal de Bruijn sequences (a theorem of Fredricksen...

[1]  Wojciech Rytter,et al.  Extracting powers and periods in a word from its runs structure , 2014, Theor. Comput. Sci..

[2]  Martin Fürer How Fast Can We Multiply Large Integers on an Actual Computer? , 2014, LATIN.

[4]  Yu Hin Au Generalized de Bruijn words for primitive words and powers , 2015, Discret. Math..

[5]  Antonio Restivo,et al.  Suffixes, Conjugates and Lyndon Words , 2013, Developments in Language Theory.

[6]  Kenneth G. Paterson,et al.  A method for constructing decodable de Bruijn sequences , 1996, IEEE Trans. Inf. Theory.

[7]  Fan Chung Graham,et al.  Universal cycles for combinatorial structures , 1992, Discret. Math..

[8]  Malte Sieveking An algorithm for division of powerseries , 2005, Computing.

[9]  Marcin Mucha,et al.  Lyndon Words and Short Superstrings , 2012, SODA.

[10]  Harold Fredricksen,et al.  Necklaces of beads in k colors and k-ary de Bruijn sequences , 1978, Discret. Math..

[11]  Jean-Pierre Duval,et al.  Génération d'une Section des Classes de Conjugaison et Arbre des Mots de Lyndon de Longueur Bornée , 1988, Theor. Comput. Sci..

[12]  Torben Hagerup,et al.  Sorting and Searching on the Word RAM , 1998, STACS.

[13]  Harold Fredricksen,et al.  An algorithm for generating necklaces of beads in two colors , 1986, Discret. Math..

[14]  Jean Pierre Duval,et al.  Factorizing Words over an Ordered Alphabet , 1983, J. Algorithms.

[15]  Keith O. Geddes,et al.  Algorithms for computer algebra , 1992 .

[16]  Tero Harju,et al.  Combinatorics on Words , 2004 .

[17]  David Thomas,et al.  The Art in Computer Programming , 2001 .

[18]  Frank Ruskey,et al.  Generating Necklaces , 1992, J. Algorithms.

[19]  Jonathan Tuliani De Bruijn sequences with efficient decoding algorithms , 2001, Discret. Math..

[20]  Donald E. Knuth The Art of Computer Programming, Volume 4, Fascicle 6: Satisfiability , 2015 .

[21]  Jean-Pierre Duval,et al.  Generation of a section of conjugation classes and Lyndon word tree of limited length , 1988 .

[22]  Wojciech Rytter,et al.  Text Algorithms , 1994 .

[23]  Donald E. Knuth,et al.  The Art of Computer Programming, Volume 4, Fascicle 2: Generating All Tuples and Permutations (Art of Computer Programming) , 2005 .

[24]  Maxime Crochemore,et al.  Algorithms on strings , 2007 .

[25]  Wojciech Rytter,et al.  Computing k-th Lyndon Word and Decoding Lexicographically Minimal de Bruijn Sequence , 2014, CPM.

[26]  Michael E. Saks,et al.  Efficient Indexing of Necklaces and Irreducible Polynomials over Finite Fields , 2014, Theory Comput..