Abstract
We present a class of languages that have an interesting property: For each language $\mathbf{L}$ in the class, both the classic greedy algorithm and the classic Lyndon word (or necklace) concatenation algorithm provide the lexicographically smallest universal cycle for $\mathbf{L}$. The languages consist of length $n$ strings over $\{1,2,\ldots ,k\}$ that are closed under rotation with their subset of necklaces also being closed under replacing any suffix of length $i$ by $i$ copies of $k$. Examples include all strings (in which case universal cycles are commonly known as de Bruijn sequences), strings that sum to at least $s$, strings with at most $d$ cyclic descents for a fixed $d>0$, strings with at most $d$ cyclic decrements for a fixed $d>0$, and strings avoiding a given period. Our class is also closed under both union and intersection, and our results generalize results of several previous papers.
Highlights
1.1 Constructing de Bruijn SequencesLet T(n, k) be the set of k-ary strings of length n
We present a class of languages that have an interesting property: For each language L in the class, both the classic greedy algorithm and the classic Lyndon word concatenation algorithm provide the lexicographically smallest universal cycle for L
Examples include all strings, strings that sum to at least s, strings with at most d cyclic descents for a fixed d > 0, strings with at most d cyclic decrements for a fixed d > 0, and strings avoiding a given period
Summary
Let T(n, k) be the set of k-ary strings of length n. The greedy algorithm for n = 2 and k = 3 will get stuck after generating 112131 if the initial sequence is the empty string or the single symbol 1. Fredricksen and Kessler [10, 11, 12] (for k = 2) and later Fredricksen and Maiorana [13] (for k 2) provided a beautiful alternative that generates each character in O(1)-amortized time and uses only O(n) space Their construction is known as the FKM algorithm and can be summarized as follows: Concatenate the aperiodic prefixes of the necklaces in T(n, k) in lexicographic order. The FKM algorithm always generates the same sequence as Martin’s algorithm and this sequence is the lexicographically smallest de Bruijn cycle for T(n, k) (see Knuth’s discussion in [19]). We will use the necklace definition because it is better suited for generalizations, as pointed out by Ruskey, Sawada, Williams [27]
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have