English

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

Data Structures and Algorithms 2023-12-13 v2 Formal Languages and Automata Theory

Abstract

We give efficient algorithms for ranking Lyndon words of length nn 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 σn\sigma^n take O(n)O(n) time. Our algorithm for ranking Lyndon words makes O(n2)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 the word-RAM to O(n2logσ)O(n^2 \log \sigma). We also present an O(n3log2σ)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 (theorem of Fredricksen and Maiorana) to develop the first polynomial-time algorithm for decoding minimal de Bruijn sequence of any rank nn (it determines the position of an arbitrary word of length nn within the de Bruijn sequence).

Keywords

Cite

@article{arxiv.1510.02637,
  title  = {Efficient Ranking of Lyndon Words and Decoding Lexicographically Minimal de Bruijn Sequence},
  author = {Tomasz Kociumaka and Jakub Radoszewski and Wojciech Rytter},
  journal= {arXiv preprint arXiv:1510.02637},
  year   = {2023}
}

Comments

Corrected an error in the proof of Theorem 32. Applied comments of reviewers from the journal submission

R2 v1 2026-06-22T11:16:30.430Z