DE BRUIJN SEQUENCES FOR FIXED-WEIGHT BINARY STRINGS

Size: px
Start display at page:

Download "DE BRUIJN SEQUENCES FOR FIXED-WEIGHT BINARY STRINGS"

Transcription

1 DE BRUIJN SEQUENCES FOR FIXED-WEIGHT BINARY STRINGS FRANK RUSKEY, JOE SAWADA, AND AARON WILLIAMS Abstract. De Bruijn sequences are circular strings of length 2 n whose length n substrings are the binary strings of length n. Our focus is on creating circular strings of length ( n w) for the binary strings of length n with weight (number of s) equal to w. In this case, each fixed-weight string can be encoded by its first n bits since the final bit is redundant. For this reason, we construct circular strings of length ( n ) ( w + n w ) whose length n substrings are the binary strings of length n with weight w or w. Our construction is reminiscent of the construction for the lexicographically least de Bruijn sequence, except the underlying algorithm is applied to cool-lex order instead of lexicographic order. The construction can be efficiently implemented so that successive blocks of n bits are generated in constant amortized time (CAT) while using O(n log n)-space. This article s results were also used to create de Bruijn sequences for binary strings of length n with a specified maximum weight. Key words. de Bruijn sequences, universal cycles, FKM algorithm, necklaces, Lyndon words, cool-lex order, middle-levels, shift Gray code. Introduction. All strings in this paper are binary. Let B(n) denote the set of strings with length n. A de Bruijn sequence for B(n) (or simply a de Bruijn sequence) is a circular string of length 2 n that contains each string in B(n) exactly once as a substring. De Bruijn sequences are also known as de Bruijn cycles. A de Bruijn sequence for B(3) appears in Figure., where the substrings are read clockwise from 2 o clock and allow wrap-around. substrings B(3):,,,,,,, Fig... A de Bruijn sequence for B(3). One can prove that de Bruijn sequences exist for B(n) by using an Eulerian cycle in its associated de Bruijn graph (see Section 2). However, this standard proof does not directly lead to an efficient method for constructingan individual de Bruijn sequencedue to the exponentialsize ofthe associatedgraph(2 n nodes and 2 n directed arcs). A fundamental question is determining the computational complexity of generating a specific de Bruijn sequence. Perhaps the most famous construction that leads to an efficient algorithm is for the lexicographically least de Bruijn sequence, which Knuth calls the grand-daddy [5]. De Bruijn sequences have many applications including dynamic connections in overlay networks (Fraigniaud and Gauron [7]), genomics (Alekseyev and Pezner []), and software calculation of the ruler function in computer words (Knuth [6], Leiserson, Prokop, and Randall [7]). De Bruijn sequences also appear in textbooks on discrete mathematics (Graham, Knuth, and Patashnik []). Generalizations and variations have been investigated, most famously under the name universal cycles (Chung, Graham and Diaconis [4]). Interested readers can refer to the Generalizations of de Bruijn Cycles and Gray Codes proceedings [4]. Our paper gives a new variation of de Bruijn sequences that restricts the weight (number of s) of each string. Let B w (n) denote the set of length n strings with fixed-weight w and let B u l (n) denote the set of length n strings with weight-range l,l+,...,u having a specified lower-bound l and upper-bound u. In general, if L is a subset of B(n), then a de Bruijn sequence for L is a circular string of length L containing Department of Computer Science, University of Victoria, PO Box 3 STN CSC, Victoria BC, V8W 3N4, Canada ruskey@cs.uvic.ca. Research supported in part by an NSERC discovery grant. School of Computer Science, University of Guelph, 27 Reynolds, Guelph ON, NG 2W, Canada jsawada@uoguelph.ca. Research supported in part by an NSERC discovery grant. School of Mathematics and Statistics, Carleton University 25 Colonel By Drive, Ottawa ON, KS 5B6, Canada haron@uvic.ca

2 each string in L exactly once as a substring. Strictly speaking, de Bruijn sequences for B w (n) only exist in trivial cases when w {,,n,n}. For example, the circular strings of length ( 4 2) = 6 containing and are,, and but none are de Bruijn sequences for B 2 (4). However, we can take advantage of a simple fact: The last bit of each string in B w (n) is redundant. That is, each α B w (n) is completely determined by its first n bits. For this reason, we say that a de Bruijn sequence for B w w (n ) is a fixed-weight de Bruijn sequence for B w (n). The circular string in Figure.2 is a fixed-weight de Bruijn sequence for B 3 (5). Its substrings of length four include each string in B 3 2 (4) exactly once; appending the missing bit extends each substring to a unique string in B 3 (5). In general, the shorthand sequence of a fixed-weight de Bruijn sequence for B w (n) is its circular sequence of substrings of length n and the longhand sequence is obtained by appending the missing bit to each string in the shorthand sequence so that each resulting string has weight w. shorthand B 3 2(4):,,,,,,,,, longhand B 3 (5):,,,,,,,,, Fig..2. A fixed-weight de Bruijn sequence for B 3 (5). Our main result is a construction of fixed-weight de Bruijn sequences for any B w (n). A subsequent analysis shows that our cool-daddy de Bruijn sequences can be created efficiently, with successive blocks of n bits being generated in amortized O()-time while using only O(n log n)-space(sawada and Williams [25, 26]). This is an improvement over algorithms that construct universal cycles one symbol at a time (compare Ruskey and Williams [22] to Ruskey, Williams, and Holroyd [2, 3] for an example of this improvement in the context of permutations). The space measurement is also important since certain algorithms for generating universal cycles use exponential space. The mathematical foundation for our construction uses a general result involving binary bubble languages and cool-lex order (Ruskey, Sawada, and Williams [2]). Our paper is organized as follows: Section 2 covers de Bruijn graphs, Section 3 describes the granddaddy de Bruijn sequence, Section 4 modifies the aforementioned construction, Section 5 covers cool-lex order, Section 6 gives the cool-daddy construction, and Section 7 discusses open problems. We mention that articles in this research area often use the term density when referring to the number of s in a binary string. This includes work by the authors of this article ([2, 25, 26]) and by other authors (Buck and Wiedemann [2], Wang and Savage [29], and Ueda [28]). However, it is more natural to interpret the density of a length n binary string with w copies of as the fraction w/n. For this reason, we use the term weight in this article. 2. de Bruijn Graphs. Thede Bruijn graph forb(n)isadirectedgraphwhosenodesetisb(n ). For each node α = a a n and x {,} there is an arc labeled x that is directed from α to β = a 2 a n x. Each arc represents a unique string αx B(n). The de Bruijn graph for B(4) is illustrated in Figure 2.. Fig. 2.. The de Bruijn graph for B(4). More generally, the de Bruijn graph for L B(n) is a directed graph G(L) whose nodes are the length 2

3 n prefixes and suffixes of the strings in L. There is an arc labeled x {,} from α = a a n to β = a 2 a n x if αx L. Again, each arc represents a unique string αx L. We are interested in de Bruijn graphs for L = B w w (n). (a) (b) Fig Two de Bruijn graphs (a) G(B 2 (4)), and (b) G(B 3 2 (4)). A directed graph is Eulerian if it has a directed cycle that includes each arc exactly once. It is wellknown that a directed graph is Eulerian if and only if it is balanced (every node has the same number of incoming and outgoing arcs) and strongly connected (there is a directed path from any node to any other node). Furthermore, Eulerian cycles in G(L) are in one-to-one correspondence with de Bruijn sequences for L. For example, Figure 2.2 (a) shows that G(B 2 (4)) is not strongly connected, and this provides an alternate proof that there are no de Bruijn sequences for B 2 (4). The connection between de Bruijn sequences and de Bruijn graphs can be found in de Bruijn s paper for B(n) [5]; also see his note on the history of these observations [6]. Table 2. illustrates the connection between an Eulerian cycle in Figure 2.2 (b) and the fixed-weight de Bruijn sequence in Figure.2. Table 2. (i) and Figure 2.2 (b) also illustrate that the node set of G(B w w (n)) is B w w 2(n ). Eulerian cycle Substrings nodes arcs shorthand longhand B 3 (3) B() B 3 2(4) B 3(5) (i) (ii) (iii) (iv) Table 2. (i) The nodes along an Eulerian cycle in the de Bruijn graph G(B 3 2 (4)) from Figure 2.2 (b), (ii) arc labels on this Eulerian cycle, and the fixed-weight de Bruijn sequence for B 3 (5) in Figure.2, (iii) its shorthand sequence, and (iv) its longhand sequence. The remainder of this section shows that G(B w w (n)) is Eulerian. Since G(B w w (n)) is directed, we shorten directed path to path. Lemma 2.. G(B w w (n)) is balanced. Proof. The node set of G(B w w (n)) is B w w 2(n ). Each α B w (n ) has in- and out-degree 2, and each α B w 2 (n ) B w (n ) has in- and out-degree. The fact that many nodes in G(B w w (n)) have out-degree contributes to the difficulty of proving that it is strongly connected. As a specific example, a maximum length shortest path in G(B 9 8 (8)) is illustrated 3

4 length 3 length 85 (a) (b) Fig Shortest path from to in (a) G(B(8)) and (b) G(B 9 8 (8)). Nodes are read top-to-bottom with black and white squares respectively for and. in Figure 2.3 (b) and has length 85. In contrast, Figure 2.3 (a) illustrates that trivial paths of length at most n exist between each pair of nodes in the original de Bruijn graph G(B(n)). To prove that G(B w w (n)) is strongly connected we repeatedly apply the following lemma. Lemma 2.2. Let α = a a n and β = b b n be distinct nodes in G(B w w (n)). If i is the smallest integer such that a i b i, then there exists a path from α to some node with prefix b b i. Proof. We assume a i = since the a i = case is similar. Note that α has three possible weights since the node set of G(B w w (n)) is B w w 2(n ). For each weight we provide a valid path (labeled by the arcs) that ends at a node with prefix b b i. If α has weight w 2, then this path suffices:,a,...,a i,,a i+,...,a n. If α has weight w, then this path suffices:,a,...,a i,,a i+,...,a n. If α has weight w, then there exists i < j n such that a j =. (Otherwise, α = a a i n i has weight w, so α s prefix a a i has weight w. However, this implies β s prefix a a i has weight w +, which contradicts β B w w 2 (n ).) First we find a path from α to γ = a a j a j+ a n as follows:,a,...,a j,,a j+,...,a n. Since γ has weight w and has the same prefix of length i as α, we can complete our path by applying the path from the w case. Through repeated application of this lemma we obtain the following corollary. Corollary 2.3. G(B w w (n)) is strongly connected. We obtain the following theorem from Lemma 2. and Corollary 2.3. Theorem 2.4. G(B w w (n)) is Eulerian. Theorem 2.4 implies the existence of fixed-weight de Bruijn sequences. Section 6 strengthens this result by providing an explicit construction. 3. The FKM Algorithm. While de Bruijn graphscanbe used toprovethat de Bruijn sequencesexist, we are instead interested in efficiently constructing individual de Bruijn sequences. Martin [8] examined this issue in 934, and proposed a simple backtracking approach that builds a de Bruijn sequence for B(n) one bit at a time. In fact, by slightly modifying his presentation, the de Bruijn sequence he creates is the lexicographically least for each value of n. Unfortunately, Martin s approach is algorithmically infeasible since it requires exponential space. Fredericksen, Kessler and Maiorana [9, 8] discovered a direct method the FKM algorithm for constructing the lexicographically least de Bruijn sequence for B(n). Describing their method requires the introduction of several basic concepts. Given distinct strings α = a a n and β = b b m, α is less than β in lexicographic order if there exists an i such that a a i = b b i and either i = n or a i+ < b i+. The sequence of a set of strings L listed in lexicographic order is denoted lex(l). A necklace is a string in its lexicographically least rotation. That is, α = a a 2 a n is a necklace if a j a j+ a n a a 2 a j α for all j. The set of necklaces in 4

5 B(n) and B w (n) are denoted N(n) and N w (n) respectively. The aperiodic prefix of string α is its shortest prefix whose repeated concatenation yields α. That is, the aperiodic prefix of α = a a 2 a n is the shortest γ = a a 2 a k such that γ n/k = α, where exponentiation denotes repeated concatenation. The aperiodic prefix of α is denoted by ρ(α). If ρ(α) n/k = α, then the number of distinct rotations of α is k; we say that α is aperiodic if k = n and is periodic otherwise. A Lyndon word is an aperiodic necklace. The set of Lyndon words in B(n) and B w (n) are denoted L(n) and L w (n), respectively. The FKM algorithm [8] produces a circular string fkm(n) that is the concatenation of the Lyndon words whose length divides n in lexicographic order. That is, fkm(n) = l l 2 l m where lex = l,l 2,...,l m. (3.) j nl(n/j) Figure 3. illustrates fkm(6) with(a) showing the Lyndon words and(b) showing their circular concatenation with as a visual separator (Figure 3. (c) and (d) are explained in Section 4). The surprising connection between lexicographic order, the FKM algorithm, and de Bruijn sequences is given in Theorem 3.. Theorem 3. ( Grand-daddy [8]). fkm(n) is a de Bruijn sequence for B(n). Lyndon words L(),L(2),L(3),L(6) lexicographic order de Bruijn sequence fkm(6) necklaces N(6) aperiodic prefixes (a) (b) (c) (d) Fig. 3.. Concatenating the Lyndon words of length, 2, 3, 6 in lexicographic order in (a) gives the grand-daddy de Bruijn sequence fkm(6) in (b). This construction can also be obtained by concatenating the aperiodic prefix in (d) of the necklaces of length 6 in (c). The de Bruijn sequence in Theorem 3. is the lexicographically least de Bruijn sequence for each B(n). A careful analysis by Ruskey, Savage, and Wang [9] proved that each successive bit in fkm(n) can be generated in amortized O()-time while using O(n)-space. In fact, their algorithm visits successive blocks of n bits in this time and space complexity. Unfortunately, fixed-weight de Bruijn sequences are not created by restricting the FKM algorithm to the appropriate fixed-weight Lyndon words. To make this observation precise, let fkm w (n) = l l 2 l m where lex j gcd(w,n) L w/j (n/j) = l,l 2,...,l m. (3.2) Figure 3.2 illustrates that fkm 4 (8) is not a fixed-weight de Bruijn sequence. In particular, fkm 4 (8) has invalid substrings such as / B 4 3(7), and repeated substrings such as. Although fkm w (n) is not a fixed-weight de Bruijn sequence, it does have the correct length of ( n w). To understand why this is true, observe that if α B w (n) has k distinct rotations, then the rotations of α 5

6 Lyndon words necklaces aperiodic L 4(8) fkm 4(8) N 4(8) prefixes lexicographic order (a) (b) (c) (d) Fig Concatenating the Lyndon words of length 2, 4, 8 and weight, 2, 4 respectively in lexicographic order in (a) does not give a fixed-weight de Bruijn sequence fkm 4 (8) in (b). The substring is repeated, and the substring is invalid. This construction can also be obtained by concatenating the aperiodic prefix in (d) of the necklaces of length 8 and weight 4 in (c). will contribute k bits to fkm w (n). Since fkm w (n) has the correct length, we will consider rearranging its constituent Lyndon words in Section Necklace-Prefix Algorithm. In this section we reformulate the FKM algorithm and then provide a simple generalization. Instead of describing fkm(n) as the concatenation of Lyndon words whose length divides n, it can be described as the concatenation of the aperiodic prefixes of the necklaces of length n. That is, fkm(n) = ρ(η ) ρ(η 2 ) ρ(η m ) where lex(n(n)) = η,η 2,...,η m. (4.) To see why the concatenations in (3.) and (4.) are identical, simply observe that ρ(η i ) = l i. The fixedweight variant of fkm(n) can be similarly described as follows fkm w (n) = ρ(η ) ρ(η 2 ) ρ(η m ) where lex(n w (n)) = η,η 2,...,η m. (4.2) These two restatements of the FKM algorithm are illustrated in Figure 3. (c)-(d) and 3.2 (c)-(d). The advantage of (4.2) over (3.2) is that lexicographic order can be replaced by other previously developed orders of fixed-weight necklaces. For the remainder of this article, a necklace-prefix algorithm refers to the concatenation ofthe aperiodic prefixesof N w (n) arrangedin some order. The reasoningat the end of Section 3 explains why the necklace-prefix algorithm produces circular strings of the correct length. There are two previously developed orders for fixed-weight necklaces [29, 28]. However, in both cases the necklace-prefix algorithm does not produce a fixed-weight de Bruijn sequence due to invalid strings. This fact is explained by the following lemma, which provides a necessary condition on the weight of prefixes in consecutive aperiodic necklaces. Lemma 4.. Suppose L is an ordering of N w (n) that contains consecutive aperiodic necklaces α = a a n and β = b b n. If there exists j such that j i= j a i i= 6 b i / {,},

7 then applying the necklace-prefix algorithm to L will not result in a fixed-weight de Bruijn sequence for B w (n) due to invalid substrings. Proof. Observe that γ = a j+ a n b b j is an invalid substring since its weight can be computed as follows: Σγ = w Σ(a a j )+Σ(b b j ) / {w,w }. The invalid substring in Figure 3.2 is explained by Lemma 4. using α =, β =, and j = 6. The lemma suggests that the necklace-prefix algorithm should be applied to orders that do not significantly change the weight of each prefix. Such an ordering is discussed in the next section. 5. Cool-lex Order. This section discusses the cool-lex order for fixed-weight binary strings and necklaces. The reverse order for fixed-weight necklaces is used in the next section. Cool-lex order is a shift Gray code for B w (n), meaning that the ( n w) fixed-weight binary strings are ordered so that successive strings differ by a single shift. If α = a a 2 a n, then a shift from the jth position to the ith position with i < j causes the substring a i a i+ a j to be replaced by a j a i a i+ a j. In other words, the symbol a j is removed and then reinserted somewhere to the left in position i; the intermediate symbols accommodate this shift by moving one position to the right. This operation is denoted by shift α (j,i), which we shorten to shift(j,i) when the initial string is clear. There is a very simple rule for cyclically creating the cool-lex order of B w (n) one string at a time: If α B w (n) and k is the length of its longest prefix of the form, then the next string in cool-lex order is shift(min(k+2, n), ). This rule was discovered by Ruskey and Williams [2], although in our discussion all bits are complemented with respect to its original presentation. By convention, the last string in the cool-lex order of B w (n) is n w w. Table 5. (a)-(b) illustrates the cool-lex order of B 4 (8) and the shifts according to this rule. cool(b 4 (8)) Gray code cool(n 4 (8)) Gray code case condition reverse shift(3,) shift(4,) (5.b) a s+t+2 = shift(4, ) shift(6, 3) (5.c) shift(5, ) shift(5, 3) (5.c) shift(6,) shift(5,) (5.b) a s+t+2 = shift(3, ) shift(7, 3) (5.c) shift(5, 2) (5.c) shift(7, ) shift(3, ) (5.b) β / L shift(8, ) shift(5, ) (5.b) β / L shift(8, ) shift(7, ) (5.b) β / L shift(8, ) shift(8, 3) (5.a) (a) (b) (c) (d) (e) (f) (g) Table 5. (a) Cool-lex orders for B 4 (8) and (b) the shifts that generate this order. The cool-lex order of N 4 (8) appears in (c), along with the corresponding shifts according to (5.) in (d)-(f). Column (g) gives the reverse order of (c). Given L B w (n) let cool(l) represent the order of strings in L according to the cool-lex order of B w (n). Recently, it was shown that cool(n w (n)) is also a shift Gray code [2]. Furthermore, the following rule cyclically creates the order one string at a time [2]. Table 5. (c)-(f) illustrates the cool-lex order of N 4 (8) along with the shifts and cases according to this rule. Condition 5.b is restated in a slightly simplified form since n is the only necklace ending in. 7

8 Cool-lex Gray code for Necklaces [2] Let α = s t γ N w (n) where s,t > and γ is empty or begins with. The necklace following α in cool-lex order is denoted next(α) and is obtained from α by the following shift shift(s+t, i+) if γ = ǫ (5.a) next(α) = shift(s+t+,) if a s+t+2 = or β / N w (n) (5.b) shift(s+t+2, i+) otherwise (5.c) where β = shift α (s+t+2,s+t+), and i is the minimum value such that i s i t γ N w (n). In [26] it is proventhat cool(n w (n)) can be generatedin constant amortizedtime. Reverse cool-lex order is cool-lex order with the relative order of the strings reversed (see Table 5. (c) and (g)). The advantage of reverse cool-lex order is that it satisfies Lemma 4.. We complete this section with two results. Lemma 5.. [2] If α is a necklace, then swapping its first (if it exists) to yields another necklace. Lemma 5.2. If α is a periodic necklace, then next(α) is an aperiodic necklace. Proof. There are two cases. If a s+t+2 =, then next(α) = shift(s+t+,) by (5.b). If a s+t+2 =, then β = shift(s+t+2,s+t+) / N w (n) and so next(α) = shift(s+t+,) by (5.b). Therefore, s+ is a prefix of next(α) so it is aperiodic, since this is its only s+ substring. 6. Cool-Daddy de Bruijn sequences. Let C w (n) denote the result of applying the necklace-prefix algorithm to the reverse cool-lex order of the necklaces of length n and weight w. That is, C w (n) = ρ(η ) ρ(η 2 ) ρ(η m ) where cool(n w (n)) = η m,η m,...,η. (6.) Figure 6. illustrates that C 4 (8) is a fixed-weight de Bruijn sequence for B 4 (8), and this section proves this result in general. To simplify our presentation, we define an additional circular string D w (n) as the concatenation of the necklaces of length n and weight w without first reducing each necklace to its aperiodic prefix. In other words, D w (n) concatenates the necklaces in their entirety, regardless of whether they are periodic or aperiodic. That is, D w (n) = η η 2 η m where cool(n w (n)) = η m,η m,...,η. (6.2) Thelengthof D w (n)exceeds ( n w),soitssubstringsoflengthn mustcontainrepeatedstringsinb w w (n ). Although it has repeated strings, Theorem 6. proves that D w (n) does not miss any strings. In other words, D w (n) s substrings include each string in B w w (n ) at least once. Theorem 6.2 then completes our main result by proving that C w (n) contains each string in B w w (n) exactly once. In these proofs we let prev(α) denote the necklace before α in cool-lex order. That is, next(prev(α)) = α. Theorem 6.. The circular string D w (n) contains each string in B w w (n ) as a substring. Proof. Every string in B w w (n ) can be written as pq such that qxp N w (n) with x {,}. Our goal is to demonstrate a necklace α N w (n) such that pq is a substring of next(α) α, and thereby a substring of D w (n). Specifically, we will provide α with prefix q such that next(α) has suffix p. As a special case, if p or q is empty then clearly we can let α = qxp. If q has prefix s t where s,t >, then α = qxp suffixes (next(α) is obtained from (5.b) or (5.c)). Otherwise, since qxp is a necklace, we can assume that q = s t where s > and t. For this remaining case we consider the two possible values for x separately and assume that the longest prefix of the form in qp is i j where i,j >. 8

9 cool-lex order necklaces aperiodic fixed-weight de Bruijn sequence N 4(8) prefixes C 4(8) (a) (b) (c) Fig. 6.. Concatenating the aperiodic prefix in (b) of the necklaces of length 8 and weight 4 in reverse cool-lex order in (a) creates the cool-daddy fixed-weight de Bruijn sequencec 4 (8) in (c). The substrings of the cycle are the ( 8 4) = 7 strings in B 4 3 (7). Assume x =. If p = k, then α = qxp suffices (next(α) is obtained from (5.a)). Otherwise, consider two cases depending on t. t : Transpose the first to in qp to obtain α, which is a necklace by Lemma 5. (next(α) is obtained from (5.c)). Note that the first must occur after q, and hence α has prefix q. t = : If qp = i j then α = qp suffices (next(α) is obtained from (5.a)); otherwise obtain α by inserting x = into position i+j +2 (after the first ) of qp (next(α) is obtained from (5.c)). Assume x =. Again we consider two cases depending on t. t : Obtain α by inserting x = into qp as far right as possible up to position i+j + so that the resulting string is a necklace (next(α) is obtained from (5.b)). Note that the will be inserted after q since qp is a necklace. t = : If it is possible to insert x = past the first in qp to obtain a necklace, then apply α as described when t. Otherwise, construct α so that next(α) = qp. Observe that α has prefix q and next(α) is obtained by (5.b). Theorem 6.2. The circular string C w (n) is a fixed-weight de Bruijn sequence for B w (n). Proof. Since C w (n) hasthecorrectlengthof ( n w), weneedonlyshowthateverystringinb w w (n)appears as a substring in C w (n). From Theorem 6., this means that we need only show that every substring in D w (n) of length n is also a substring in C w (n). For this reason, let us consider an arbitrary periodic necklace N w (n) of the form γ k where γ is the aperiodic prefix. Since consecutive necklaces cannot both be periodic by Lemma 5.2, we must show that each length n substring of next(γ k ) γ k prev(γ k ) is also a substring of next(γ k ) γ prev(γ k ). This can be verified by applying the iterative cool-lex rules and considering two cases for γ where s,t > and ω is non-empty: γ = s t next(γ k ) γ prev(γ k ) = s t γ k 2 γ s t γ = s t ω next(γ k ) γ prev(γ k ) = γ k γ prev(γ k ). From this illustration, it should be clear in both cases that each length n substring in next(γ k ) γ k prev(γ k ) is also a substring of next(γ k ) γ prev(γ k ). 7. Summary and Open Problems. This paper provides an explicit fixed-weight de Bruijn sequence. It is constructed by concatenating the aperiodic prefixes of fixed-weight necklaces in reverse cool-lex order. 9

10 An algorithm in [26] shows that this fixed-weight de Bruijn sequence can be generated efficiently, with successive blocks of n bits being generated in amortized O()-time while using only O(n log n)-space. In addition to these results, we also investigated the de Bruijn graph G(B w w (n)). We conclude with additional observations and natural open problems:. Can specific constructions of weight-range de Bruijn sequences for B u l (n) with l < u be generated efficiently? Theorem6.2 provesthe answeris yes for l = u. Morespecifically, C w (n+) provides an explicit construction since its substrings of length n are precisely B u l (n) for l = w and u = w. Sawada, Stevens, and Williams [24] have solved the l = case. Their construction efficiently glues together copies of C i (n+) for i = w,w 2,w 4,... (and inserts a single to create the substring n when the maximum-weight u is even). This construction was recently extended to include all cases where u l is odd by Stevens and Williams [27] by using the necklace-prefix algorithm and a natural generalization of cool-lex order from B w (n) to B u l (n). The remaining open case is when u l is even, where the weight-range {l,l+,...,u} contains an odd number of values. 2. The set B w w (n) with n = 2w is known as the middle-levels. A well-known open problem is to determine if there is a Hamming distance Gray code for the middle-levels (see Savage and Winkler [23]). Our results have provided a universal cycle for the middle-levels. 3. The shorthand sequence of B w w (n ) appears in a single-track order when obtained from a fixed-weight de Bruijn sequence for B w (n) (see Hiltgen et al [] for single-track Gray codes). For example, see Table 2. (iii). Which other sets of binary strings have single-track orders? 4. The longhand sequence of B w (n) appears in a special cyclic order when obtained from a fixedweight de Bruijn sequence for B w (n): Successive strings differ by the prefix-rotation σ n or σ n. For example, see Table 2. (iv). It was proven that σ 2 and σ n cannot be used to create a Gray code for B w (n) by Cheng [3]. The sufficiency of σ n and σ n, and the insufficiency of σ 2 and σ n, are two special cases of a general question asked in [2]: Which sets of σ i are necessary and sufficient for generating a (cyclic) Gray code for B w (n)? 5. What is the maximum and minimum number of σ n that can be used in a (σ n,σ n ) Gray code for B w (n)? How many of each operation are used when B w (n) is ordered according to C w (n)? The analogous maximization problem has been solved for permutations by a natural construction [3]. 6. The grand-daddy de Bruijn sequence for B(n) is the first de Bruijn sequence for B(n) in lexicographic order. The cool-daddy de Bruijn sequences for B w (n) are neither the first nor last in lexicographic order or cool-lex order. For example, from Figure.2 is bracketed by the fixed-weight de Bruijn sequences and in both lexicographic and cool-lex order. What is the first fixed-weight de Bruijn sequence for B w (n) in lexicographic order, and can it be constructed directly without backtracking? 7. The necklace-prefix algorithm creates de Bruijn sequences when using lexicographic order, and creates fixed-weight de Bruijn sequences when using reverse cool-lex order. Are these orders special in this respect or are there many orders with these properties? 8. Removing the last redundant symbol of each string is also used in constructing universal cycles for permutations [22, 2, 3]. Similarly, shorthand representations are natural for any fixed-content language in which the frequency of each symbol is fixed. Which other fixed-content languages have shorthand universal cycles? A final open problem is to determine the diameter (length of the longest shortest path) of the de Bruijn graph for B w w (n), or more generally Bw u (n). For small values of n and w we computed the diameter of

11 G(B w w (n)) in Table 7., as well as pairs of nodes that achieve the maximum diameter for each n. (Table 7. assumes w n/2 since G(B w w (n)) and G(Bn w n w+ (n)) are isomorphic.) A conjecture appears below. n w = n/2,...,n (α,β) (, ) 6 9 (, ) (, ) (, ) (, ) (, ) (, ) (, ) (, ) (, ) (, ) (, ) (, ) (, ) Table 7. Diameter of G(B w w (n)) for n 8. The (α,β) pairs give strings at maximum distance for each n. Conjecture 7.. The de Bruijn graph G(B w w (n)) has maximal diameter ( ) n+ 2 /2 when w = n/2 for (n mod 4) 3 and w = n/2 otherwise. Moreover, this maximal diameter is obtained by the nodes x y and a b c d for x = n 2, y = n 2, a = n 4, b = n+3 4, c = n+2 4, and d = n Acknowledgments. The authors thank Glenn Hurlbert and Garth Isaak for helpful discussions regarding de Bruijn graphs at canadam 29. REFERENCES [] Max A. Alekseyev and Pavel A. Pevzner. Colored de Bruijn graphs and the genome halving problem. IEEE/ACM Transactions on Computational Biology and Bioinformatics (TCBB), 4():98 7, January 27. [2] M. Buck and D. Wiedemann. Gray codes with restricted density. Discrete Mathematics, 48(2 3):63 7, 984. [3] Yongxi Cheng. Generating combinations by three basic operations. Journal of Computer Science and Technology, 22(6):99 93, 27. [4] F. Chung, P. Diaconis, and R.L. Graham. Universal cycles for combinatorial structures. Discrete Mathematics, :43 59, 992. [5] N.G. de Bruijn. A combinatorial problem. Koninkl. Nederl. Acad. Wetensch. Proc. Ser A, 49: , 946. [6] N.G. de Bruijn. Acknowledgement of priority to C. Flye Sainte-Marie on the counting of circular arrangements of 2n zeros and ones that show each n-letter word exactly once. T.H. Report 75-WSK-6, Technological University Eindhoven, pages. [7] Pierre Fraigniaud and Philippe Gauron. D2B: A de Bruijn based content-addressable network. Theoretical Computer Science, 355():65 79, 26. [8] H. Fredericksen and I. J. Kessler. An algorithm for generating necklaces of beads in two colors. Discrete Mathematics, 6:8 88, 986. [9] H. Fredericksen and J. Maiorana. Necklaces of beads in k colors and kary de Bruijn sequences. Discrete Mathematics, 23(3):27 2, 978. [] R. L. Graham, D. E. Knuth, and O. Patashnik. Concrete Mathematics. Adison Wesley, 994. [] A.P. Hiltgen, K.G. Paterson, and M. Brandestini. Single-track Gray codes. IEEE Transactions on Information Theory, 42(5):555 56, Sept [2] A. Holroyd, F. Ruskey, and A. Williams. Faster generation of shorthand universal cycles for permutations. In COCOON 2: The 6th Annual International Computing and Combinatorics Conference, volume 696 of Lecture Notes in Computer Science, pages , Nha Trang, Vietnam, 2. Springer-Verlag. [3] A. Holroyd, F. Ruskey, and A. Williams. Shorthand universal cycles for permutations. Algorithmica, 22, to appear.

12 [4] G. Hurlbert, B. Jackson, and B. Stevens, editors. Generalizations of de Bruijn Cycles and Gray Codes, volume 39 of Discete Mathematics. Elsevier, 29. [5] D. E. Knuth. The Art of Computer Programming, volume 4 fascicle 2: Generating All Tuples and Permutations. Addison- Wesley, errata (updated /2/28) edition, 25. ISBN [6] D. E. Knuth. The Art of Computer Programming, volume 4 fascicle - Bitwise Tricks & Techniques, Binary Decison Diagrams. Addison-Wesley, 29. ISBN [7] C.E. Leiserson, H. Prokop, and K.H. Randall. Using de Bruijn sequences to index a in a computer word, 998. [Online; accessed June 29]. [8] M. H. Martin. A problem in arrangements. Bull. Amer. Math. Soc., 4: , 934. [9] F. Ruskey, C. Savage, and T.M.Y. Wang. Generating necklaces. J. Algorithms, 3:44 43, 992. [2] F. Ruskey, J. Sawada, and A. Williams. Binary bubble languages and cool-lex Gray codes. Journal of Combinatorial Theory, Series A, 9():55 69, 22. [2] F. Ruskey and A. Williams. The coolest way to generate combinations. Discrete Mathematics, 39(7): , September 29. [22] F. Ruskey and A. Williams. An explicit universal cycle for the (n )-permutations of an n-set. ACM Transactions on Algorithms, 6(3), June 2. [23] C. Savage and P. Winkler. Monotone Gray codes and the middle levels problem. J. Combin. Theory Ser. A, 7(2):23 248, 995. [24] J. Sawada, B. Stevens, and A. Williams. De Bruijn sequences for the binary strings with a maximum density. In WALCOM 2: The 5th International Workshop on Algorithms and Computation, volume 6552 of Lecture Notes in Computer Science, pages 82 9, New Dehli, India, 2. Springer-Verlag. [25] J. Sawada and A. Williams. Efficient oracles for generating binary bubble languages. Electronic Journal of Combinatorics, 9:P42, 22. [26] J. Sawada and A. Williams. A Gray code for fixed-density necklaces and Lyndon words in constant amortized time. Theoretical Computer Science, 22, in press (DOI:.6/j.tcs.22..3). [27] B. Stevens and A. Williams. The coolest order of binary strings. In FUN 2: Sixth International Conference on Fun with Algorithms, Lecture Notes in Computer Science, San Servolo, Italy, 22, to appear. Springer-Verlag. [28] T. Ueda. Gray codes for necklaces. Discrete Mathematics, 29(-3): , 2. [29] T.M.Y. Wang and C. Savage. A Gray code for necklaces of fixed density. SIAM Journal on Discrete Mathematics, 9(4): ,

De Bruijn Sequences for the Binary Strings with Maximum Density

De Bruijn Sequences for the Binary Strings with Maximum Density De Bruijn Sequences for the Binary Strings with Maximum Density Joe Sawada 1, Brett Stevens 2, and Aaron Williams 2 1 jsawada@uoguelph.ca School of Computer Science, University of Guelph, CANADA 2 brett@math.carleton.ca

More information

GENERALIZING THE CLASSIC GREEDY AND NECKLACE CONSTRUCTIONS OF DE BRUIJN SEQUENCES AND UNIVERSAL CYCLES

GENERALIZING THE CLASSIC GREEDY AND NECKLACE CONSTRUCTIONS OF DE BRUIJN SEQUENCES AND UNIVERSAL CYCLES GENERALIZING THE CLASSIC GREEDY AND NECKLACE CONSTRUCTIONS OF DE BRUIJN SEQUENCES AND UNIVERSAL CYCLES JOE SAWADA, AARON WILLIAMS, AND DENNIS WONG Abstract. We present a class of languages that have an

More information

Fixed-Density Necklaces and Lyndon Words in Cool-lex Order

Fixed-Density Necklaces and Lyndon Words in Cool-lex Order Fixed-Density Necklaces and Lyndon Words in Cool-lex Order J. Sawada A. Williams July 6, 2009 Abstract This paper creates a simple Gray code for fixed-density binary necklaces and Lyndon words. The Gray

More information

Finding the Largest Fixed-Density Necklace and Lyndon word

Finding the Largest Fixed-Density Necklace and Lyndon word Finding the Largest Fixed-Density Necklace and Lyndon word Joe Sawada Patrick Hartman April 18, 2017 Abstract We present an O(n) time algorithm for finding the lexicographically largest fixed-density necklace

More information

September 6, Abstract

September 6, Abstract A simple shift rule for -ary de Bruijn sequences Joe Sawada Aaron Williams Dennis Wong September 6, 2016 Abstract A -ary de Bruijn sequence of order n is a cyclic sequence of length n in which each -ary

More information

A fast algorithm to generate necklaces with xed content

A fast algorithm to generate necklaces with xed content Theoretical Computer Science 301 (003) 477 489 www.elsevier.com/locate/tcs Note A fast algorithm to generate necklaces with xed content Joe Sawada 1 Department of Computer Science, University of Toronto,

More information

The Coolest Way To Generate Combinations

The Coolest Way To Generate Combinations The Coolest Way To Generate Combinations Frank Ruskey and Aaron Williams Dept of Computer Science, University of Victoria Abstract We present a practical and elegant method for generating all (s, t)-combinations

More information

LOOPLESS GENERATION OF MULTISET PERMUTATIONS BY PREFIX SHIFTS

LOOPLESS GENERATION OF MULTISET PERMUTATIONS BY PREFIX SHIFTS LOOPLESS GENERATION OF MULTISET PERMUTATIONS BY PREFIX SHIFTS AARON WILLIAMS UNIVERSITY OF VICTORIA, CANADA Abstract. This paper answers the following mathematical question: Can multiset permutations be

More information

AN EXPLICIT UNIVERSAL CYCLE FOR THE (n 1)-PERMUTATIONS OF AN n-set

AN EXPLICIT UNIVERSAL CYCLE FOR THE (n 1)-PERMUTATIONS OF AN n-set AN EXPLICIT UNIVERSAL CYCLE FOR THE (n 1)-PERMUTATIONS OF AN n-set FRANK RUSKEY AND AARON WILLIAMS Abstract. We show how to construct an explicit Hamilton cycle in the directed Cayley graph Cay({σ n, σ

More information

Antipodal Gray Codes

Antipodal Gray Codes Antipodal Gray Codes Charles E Killian, Carla D Savage,1 Department of Computer Science N C State University, Box 8206 Raleigh, NC 27695, USA Abstract An n-bit Gray code is a circular listing of the 2

More information

A PASCAL-LIKE BOUND FOR THE NUMBER OF NECKLACES WITH FIXED DENSITY

A PASCAL-LIKE BOUND FOR THE NUMBER OF NECKLACES WITH FIXED DENSITY A PASCAL-LIKE BOUND FOR THE NUMBER OF NECKLACES WITH FIXED DENSITY I. HECKENBERGER AND J. SAWADA Abstract. A bound resembling Pascal s identity is presented for binary necklaces with fixed density using

More information

HAMMING DISTANCE FROM IRREDUCIBLE POLYNOMIALS OVER F Introduction and Motivation

HAMMING DISTANCE FROM IRREDUCIBLE POLYNOMIALS OVER F Introduction and Motivation HAMMING DISTANCE FROM IRREDUCIBLE POLYNOMIALS OVER F 2 GILBERT LEE, FRANK RUSKEY, AND AARON WILLIAMS Abstract. We study the Hamming distance from polynomials to classes of polynomials that share certain

More information

GRAY codes were found by Gray [15] and introduced

GRAY codes were found by Gray [15] and introduced IEEE TRANSACTIONS ON INFORMATION THEORY, VOL 45, NO 7, NOVEMBER 1999 2383 The Structure of Single-Track Gray Codes Moshe Schwartz Tuvi Etzion, Senior Member, IEEE Abstract Single-track Gray codes are cyclic

More information

Alternative Combinatorial Gray Codes

Alternative Combinatorial Gray Codes Alternative Combinatorial Gray Codes Cormier-Iijima, Samuel sciyoshi@gmail.com December 17, 2010 Abstract Gray codes have numerous applications in a variety of fields, including error correction, encryption,

More information

Gray Codes and Overlap Cycles for Restricted Weight Words

Gray Codes and Overlap Cycles for Restricted Weight Words Gray Codes and Overlap Cycles for Restricted Weight Words Victoria Horan Air Force Research Laboratory Information Directorate Glenn Hurlbert School of Mathematical and Statistical Sciences Arizona State

More information

De Bruijn Sequences for the Binary Strings with Maximum Specified Density

De Bruijn Sequences for the Binary Strings with Maximum Specified Density De Bruij Sequeces for the Biary Strigs with Maximum Specified Desity Joe Sawada 1, Brett Steves 2, ad Aaro Williams 2 1 jsawada@uoguelph.ca School of Computer Sciece, Uiversity of Guelph, CANADA 2 brett@math.carleto.ca

More information

New successor rules for constructing de Bruijn sequences

New successor rules for constructing de Bruijn sequences New successor rules for constructing de Bruijn sequences Dennis Wong Northwest Missouri State University Daniel Gabric and Joe Sawada University of Guelph, CAN Aaron Williams Simon s Rock, USA Southeastern

More information

Hamiltonicity of digraphs for universal cycles of permutations

Hamiltonicity of digraphs for universal cycles of permutations Hamiltonicity of digraphs for universal cycles of permutations Garth Isaak Abstract The digraphs P (n, k) have vertices corresponding to length k permutations of an n set and arcs corresponding to (k +

More information

arxiv: v2 [math.co] 23 Nov 2015

arxiv: v2 [math.co] 23 Nov 2015 Locating Patterns in the De Bruijn Torus arxiv:1505.04065v2 [math.co] 23 Nov 2015 Victoria Horan Air Force Research Laboratory Information Directorate Brett Stevens School of Mathematics and Statistics

More information

Sequences that satisfy a(n a(n)) = 0

Sequences that satisfy a(n a(n)) = 0 Sequences that satisfy a(n a(n)) = 0 Nate Kube Frank Ruskey October 13, 2005 Abstract We explore the properties of some sequences for which a(n a(n)) = 0. Under the natural restriction that a(n) < n the

More information

arxiv: v1 [math.co] 30 Mar 2010

arxiv: v1 [math.co] 30 Mar 2010 arxiv:1003.5939v1 [math.co] 30 Mar 2010 Generalized Fibonacci recurrences and the lex-least De Bruijn sequence Joshua Cooper April 1, 2010 Abstract Christine E. Heitsch The skew of a binary string is the

More information

On Minimal Words With Given Subword Complexity

On Minimal Words With Given Subword Complexity On Minimal Words With Given Subword Complexity Ming-wei Wang Department of Computer Science University of Waterloo Waterloo, Ontario N2L 3G CANADA m2wang@neumann.uwaterloo.ca Jeffrey Shallit Department

More information

THE COOLEST WAY TO GENERATE COMBINATIONS

THE COOLEST WAY TO GENERATE COMBINATIONS THE COOLEST WAY TO GENERATE COMBINATIONS FRANK RUSKEY AND AARON WILLIAMS Abstract We present a practical and elegant method for generating all (s, t)-combinations (binary strings with s zeros and t ones):

More information

A REPRESENTATION THEORETIC APPROACH TO SYNCHRONIZING AUTOMATA

A REPRESENTATION THEORETIC APPROACH TO SYNCHRONIZING AUTOMATA A REPRESENTATION THEORETIC APPROACH TO SYNCHRONIZING AUTOMATA FREDRICK ARNOLD AND BENJAMIN STEINBERG Abstract. This paper is a first attempt to apply the techniques of representation theory to synchronizing

More information

c 2002 Society for Industrial and Applied Mathematics

c 2002 Society for Industrial and Applied Mathematics SIAM J. DISCRETE MATH. Vol. 15, No. 4, pp. 546 561 c 2002 Society for Industrial and Applied Mathematics A FAST ALGORITHM FOR GENERATING NONISOMORPHIC CHORD DIAGRAMS JOE SAWADA Abstract. Using a new string

More information

Necklaces Pólya s Enumeration Theorem. Pólya Counting I. Gordon Royle. Semester 1, 2004

Necklaces Pólya s Enumeration Theorem. Pólya Counting I. Gordon Royle. Semester 1, 2004 Semester 1, 2004 George Pólya (1887 1985) George Polya discovered a powerful general method for enumerating the number of orbits of a group on particular configurations. This method became known as the

More information

Exhaustive generation for ballot sequences in lexicographic and Gray code order

Exhaustive generation for ballot sequences in lexicographic and Gray code order Exhaustive generation for ballot sequences in lexicographic and Gray code order Ahmad Sabri Department of Informatics Gunadarma University, Depok, Indonesia sabri@staff.gunadarma.ac.id Vincent Vajnovszki

More information

New Minimal Weight Representations for Left-to-Right Window Methods

New Minimal Weight Representations for Left-to-Right Window Methods New Minimal Weight Representations for Left-to-Right Window Methods James A. Muir 1 and Douglas R. Stinson 2 1 Department of Combinatorics and Optimization 2 School of Computer Science University of Waterloo

More information

arxiv: v1 [cs.dm] 13 Feb 2010

arxiv: v1 [cs.dm] 13 Feb 2010 Properties of palindromes in finite words arxiv:1002.2723v1 [cs.dm] 13 Feb 2010 Mira-Cristiana ANISIU Valeriu ANISIU Zoltán KÁSA Abstract We present a method which displays all palindromes of a given length

More information

1 Alphabets and Languages

1 Alphabets and Languages 1 Alphabets and Languages Look at handout 1 (inference rules for sets) and use the rules on some examples like {a} {{a}} {a} {a, b}, {a} {{a}}, {a} {{a}}, {a} {a, b}, a {{a}}, a {a, b}, a {{a}}, a {a,

More information

Generating Necklaces. North Carolina State University, Box 8206

Generating Necklaces. North Carolina State University, Box 8206 Generating Necklaces Frank Ruskey Department of Computer Science University of Victoria, P. O. Box 1700 Victoria, B. C. V8W 2Y2 CND Carla Savage y Terry MinYih Wang Department of Computer Science North

More information

On the longest increasing subsequence of a circular list

On the longest increasing subsequence of a circular list On the longest increasing subsequence of a circular list M. H. Albert M. D. Atkinson Doron Nussbaum Jörg-Rüdiger Sack Nicola Santoro Abstract The longest increasing circular subsequence (LICS) of a list

More information

Interval minors of complete bipartite graphs

Interval minors of complete bipartite graphs Interval minors of complete bipartite graphs Bojan Mohar Department of Mathematics Simon Fraser University Burnaby, BC, Canada mohar@sfu.ca Arash Rafiey Department of Mathematics Simon Fraser University

More information

Two algorithms extending a perfect matching of the hypercube into a Hamiltonian cycle

Two algorithms extending a perfect matching of the hypercube into a Hamiltonian cycle Two algorithms extending a perfect matching of the hypercube into a Hamiltonian cycle Jiří Fink Department of Theoretical Computer Science and Mathematical Logic Faculty of Mathematics and Physics Charles

More information

New Constructions for De Bruijn Tori

New Constructions for De Bruijn Tori New Constructions for De Bruijn Tori Glenn Hurlbert Garth Isaak Dedicated to the memory of Tony Brewster Abstract A De Bruijn torus is a periodic d dimensional k ary array such that each n 1 n d k ary

More information

Spherical Venn Diagrams with Involutory Isometries

Spherical Venn Diagrams with Involutory Isometries Spherical Venn Diagrams with Involutory Isometries Frank Ruskey Mark Weston Department of Computer Science University of Victoria PO BOX 3055, Victoria, BC Canada V8W 3P6 {ruskey,mweston}@cs.uvic.ca Submitted:

More information

Independent even cycles in the Pancake graph and greedy Prefix reversal Gray codes.

Independent even cycles in the Pancake graph and greedy Prefix reversal Gray codes. Graphs and Combinatorics manuscript No. (will be inserted by the editor) Independent even cycles in the Pancake graph and greedy Prefix reversal Gray codes. Elena Konstantinova Alexey Medvedev Received:

More information

Enumerating split-pair arrangements

Enumerating split-pair arrangements Journal of Combinatorial Theory, Series A 115 (28 293 33 www.elsevier.com/locate/jcta Enumerating split-pair arrangements Ron Graham 1, Nan Zang Department of Computer Science, University of California

More information

GENERALIZATIONS OF SOME ZERO-SUM THEOREMS. Sukumar Das Adhikari Harish-Chandra Research Institute, Chhatnag Road, Jhusi, Allahabad , INDIA

GENERALIZATIONS OF SOME ZERO-SUM THEOREMS. Sukumar Das Adhikari Harish-Chandra Research Institute, Chhatnag Road, Jhusi, Allahabad , INDIA INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 8 (2008), #A52 GENERALIZATIONS OF SOME ZERO-SUM THEOREMS Sukumar Das Adhikari Harish-Chandra Research Institute, Chhatnag Road, Jhusi, Allahabad

More information

Transducers for bidirectional decoding of prefix codes

Transducers for bidirectional decoding of prefix codes Transducers for bidirectional decoding of prefix codes Laura Giambruno a,1, Sabrina Mantaci a,1 a Dipartimento di Matematica ed Applicazioni - Università di Palermo - Italy Abstract We construct a transducer

More information

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) Definition 1 (Alphabet) A alphabet is a finite set of objects called symbols. Definition 2 (String)

More information

arxiv: v1 [math.co] 25 Apr 2013

arxiv: v1 [math.co] 25 Apr 2013 GRAHAM S NUMBER IS LESS THAN 2 6 MIKHAIL LAVROV 1, MITCHELL LEE 2, AND JOHN MACKEY 3 arxiv:1304.6910v1 [math.co] 25 Apr 2013 Abstract. In [5], Graham and Rothschild consider a geometric Ramsey problem:

More information

More on prefix normal words

More on prefix normal words More on prefix normal words Péter Burcsi, Gabriele Fici, Zsuzsanna Lipták, Frank Ruskey, and Joe Sawada LSD/LAW 2015 London, 5-6 Feb. 2015 Prefix normal words Fici, L. (DLT 2011) Definition A binary word

More information

This article was published in an Elsevier journal. The attached copy is furnished to the author for non-commercial research and education use, including for instruction at the author s institution, sharing

More information

Combinatorial Interpretations of a Generalization of the Genocchi Numbers

Combinatorial Interpretations of a Generalization of the Genocchi Numbers 1 2 3 47 6 23 11 Journal of Integer Sequences, Vol. 7 (2004), Article 04.3.6 Combinatorial Interpretations of a Generalization of the Genocchi Numbers Michael Domaratzki Jodrey School of Computer Science

More information

Sorting suffixes of two-pattern strings

Sorting suffixes of two-pattern strings Sorting suffixes of two-pattern strings Frantisek Franek W. F. Smyth Algorithms Research Group Department of Computing & Software McMaster University Hamilton, Ontario Canada L8S 4L7 April 19, 2004 Abstract

More information

The Interlace Polynomial of Graphs at 1

The Interlace Polynomial of Graphs at 1 The Interlace Polynomial of Graphs at 1 PN Balister B Bollobás J Cutler L Pebody July 3, 2002 Department of Mathematical Sciences, University of Memphis, Memphis, TN 38152 USA Abstract In this paper we

More information

Universal Juggling Cycles

Universal Juggling Cycles Universal Juggling Cycles Fan Chung y Ron Graham z Abstract During the past several decades, it has become popular among jugglers (and juggling mathematicians) to represent certain periodic juggling patterns

More information

There are no Barker arrays having more than two dimensions

There are no Barker arrays having more than two dimensions There are no Barker arrays having more than two dimensions Jonathan Jedwab Matthew G. Parker 5 June 2006 (revised 7 December 2006) Abstract Davis, Jedwab and Smith recently proved that there are no 2-dimensional

More information

On the complexity of approximate multivariate integration

On the complexity of approximate multivariate integration On the complexity of approximate multivariate integration Ioannis Koutis Computer Science Department Carnegie Mellon University Pittsburgh, PA 15213 USA ioannis.koutis@cs.cmu.edu January 11, 2005 Abstract

More information

Counting k-marked Durfee Symbols

Counting k-marked Durfee Symbols Counting k-marked Durfee Symbols Kağan Kurşungöz Department of Mathematics The Pennsylvania State University University Park PA 602 kursun@math.psu.edu Submitted: May 7 200; Accepted: Feb 5 20; Published:

More information

Unbordered Factors and Lyndon Words

Unbordered Factors and Lyndon Words Unbordered Factors and Lyndon Words J.-P. Duval Univ. of Rouen France T. Harju Univ. of Turku Finland September 2006 D. Nowotka Univ. of Stuttgart Germany Abstract A primitive word w is a Lyndon word if

More information

Shortest paths with negative lengths

Shortest paths with negative lengths Chapter 8 Shortest paths with negative lengths In this chapter we give a linear-space, nearly linear-time algorithm that, given a directed planar graph G with real positive and negative lengths, but no

More information

SYMMETRIC CHAIN DECOMPOSITION FOR CYCLIC QUOTIENTS OF BOOLEAN ALGEBRAS AND RELATION TO CYCLIC CRYSTALS

SYMMETRIC CHAIN DECOMPOSITION FOR CYCLIC QUOTIENTS OF BOOLEAN ALGEBRAS AND RELATION TO CYCLIC CRYSTALS SYMMETRIC CHAIN DECOMPOSITION FOR CYCLIC QUOTIENTS OF BOOLEAN ALGEBRAS AND RELATION TO CYCLIC CRYSTALS PATRICIA HERSH AND ANNE SCHILLING Abstract. The quotient of a Boolean algebra by a cyclic group is

More information

EFRON S COINS AND THE LINIAL ARRANGEMENT

EFRON S COINS AND THE LINIAL ARRANGEMENT EFRON S COINS AND THE LINIAL ARRANGEMENT To (Richard P. S. ) 2 Abstract. We characterize the tournaments that are dominance graphs of sets of (unfair) coins in which each coin displays its larger side

More information

Quadratic-backtracking Algorithm for String Reconstruction from Substring Compositions

Quadratic-backtracking Algorithm for String Reconstruction from Substring Compositions Quadratic-backtracking Algorithm for String Reconstruction from Substring Compositions Jayadev Acharya UCSD jacharya@ucsdedu Hirakendu Das Yahoo Labs hdas@yahoo-inccom Olgica Milenkovic UIUC milenkov@uiucedu

More information

Efficient Polynomial-Time Algorithms for Variants of the Multiple Constrained LCS Problem

Efficient Polynomial-Time Algorithms for Variants of the Multiple Constrained LCS Problem Efficient Polynomial-Time Algorithms for Variants of the Multiple Constrained LCS Problem Hsing-Yen Ann National Center for High-Performance Computing Tainan 74147, Taiwan Chang-Biau Yang and Chiou-Ting

More information

De Bruijn sequences on primitive words and squares

De Bruijn sequences on primitive words and squares De Bruijn sequences on primitive words and squares arxiv:0904.3997v2 [math.co] 24 Nov 2009 Yu-Hin Au Department of Combinatorics & Optimization yau@uwaterloo.ca November 24, 2009 Abstract We present a

More information

Generating All Circular Shifts by Context-Free Grammars in Chomsky Normal Form

Generating All Circular Shifts by Context-Free Grammars in Chomsky Normal Form Generating All Circular Shifts by Context-Free Grammars in Chomsky Normal Form Peter R.J. Asveld Department of Computer Science, Twente University of Technology P.O. Box 217, 7500 AE Enschede, the Netherlands

More information

De Bruijn Sequences Revisited

De Bruijn Sequences Revisited De Bruijn Sequences Revisited Lila Kari Zhi Xu The University of Western Ontario, London, Ontario, Canada N6A 5B7 lila@csd.uwo.ca zxu@google.com Abstract A (non-circular) de Bruijn sequence w of order

More information

Greedy Conjecture for Strings of Length 4

Greedy Conjecture for Strings of Length 4 Greedy Conjecture for Strings of Length 4 Alexander S. Kulikov 1, Sergey Savinov 2, and Evgeniy Sluzhaev 1,2 1 St. Petersburg Department of Steklov Institute of Mathematics 2 St. Petersburg Academic University

More information

CSC173 Workshop: 13 Sept. Notes

CSC173 Workshop: 13 Sept. Notes CSC173 Workshop: 13 Sept. Notes Frank Ferraro Department of Computer Science University of Rochester September 14, 2010 1 Regular Languages and Equivalent Forms A language can be thought of a set L of

More information

Zero-Sum Flows in Regular Graphs

Zero-Sum Flows in Regular Graphs Zero-Sum Flows in Regular Graphs S. Akbari,5, A. Daemi 2, O. Hatami, A. Javanmard 3, A. Mehrabian 4 Department of Mathematical Sciences Sharif University of Technology Tehran, Iran 2 Department of Mathematics

More information

Further discussion of Turing machines

Further discussion of Turing machines Further discussion of Turing machines In this lecture we will discuss various aspects of decidable and Turing-recognizable languages that were not mentioned in previous lectures. In particular, we will

More information

The Intractability of Computing the Hamming Distance

The Intractability of Computing the Hamming Distance The Intractability of Computing the Hamming Distance Bodo Manthey and Rüdiger Reischuk Universität zu Lübeck, Institut für Theoretische Informatik Wallstraße 40, 23560 Lübeck, Germany manthey/reischuk@tcs.uni-luebeck.de

More information

Factorizations of the Fibonacci Infinite Word

Factorizations of the Fibonacci Infinite Word 2 3 47 6 23 Journal of Integer Sequences, Vol. 8 (205), Article 5.9.3 Factorizations of the Fibonacci Infinite Word Gabriele Fici Dipartimento di Matematica e Informatica Università di Palermo Via Archirafi

More information

On the Entropy of a Two Step Random Fibonacci Substitution

On the Entropy of a Two Step Random Fibonacci Substitution Entropy 203, 5, 332-3324; doi:0.3390/e509332 Article OPEN ACCESS entropy ISSN 099-4300 www.mdpi.com/journal/entropy On the Entropy of a Two Step Random Fibonacci Substitution Johan Nilsson Department of

More information

Word-representability of line graphs

Word-representability of line graphs Word-representability of line graphs Sergey Kitaev,1,3, Pavel Salimov,1,2, Christopher Severs,1, and Henning Úlfarsson,1 1 Reykjavik University, School of Computer Science, Menntavegi 1, 101 Reykjavik,

More information

Spectrally arbitrary star sign patterns

Spectrally arbitrary star sign patterns Linear Algebra and its Applications 400 (2005) 99 119 wwwelseviercom/locate/laa Spectrally arbitrary star sign patterns G MacGillivray, RM Tifenbach, P van den Driessche Department of Mathematics and Statistics,

More information

UNPREDICTABLE BINARY STRINGS

UNPREDICTABLE BINARY STRINGS UNPREDICTABLE BINARY STRINGS R.M. LOW, M. STAMP, R. CRAIGEN, AND G. FAUCHER Abstract. We examine a class of binary strings arising from considerations about stream cipher encryption: to what degree can

More information

De Bruijn Cycles for Covering Codes

De Bruijn Cycles for Covering Codes De Bruijn Cycles for Covering Codes Fan Chung, 1 Joshua N. Cooper 1,2 1 Department of Mathematics, University of California, San Diego, La Jolla, California 92093 2 Courant Institute of Mathematical Sciences,

More information

Complete words and superpatterns

Complete words and superpatterns Honors Theses Mathematics Spring 2015 Complete words and superpatterns Yonah Biers-Ariel Penrose Library, Whitman College Permanent URL: http://hdl.handle.net/10349/20151078 This thesis has been deposited

More information

Coloring k-trees with forbidden monochrome or rainbow triangles

Coloring k-trees with forbidden monochrome or rainbow triangles Coloring k-trees with forbidden monochrome or rainbow triangles Julian Allagan & Vitaly Voloshin Department of Mathematics, University of North Georgia, Watkinsville, Georgia email: julian.allagan@ung.edu

More information

Some results on the existence of t-all-or-nothing transforms over arbitrary alphabets

Some results on the existence of t-all-or-nothing transforms over arbitrary alphabets Some results on the existence of t-all-or-nothing transforms over arbitrary alphabets Navid Nasr Esfahani, Ian Goldberg and Douglas R. Stinson David R. Cheriton School of Computer Science University of

More information

On the discrepancy of circular sequences of reals

On the discrepancy of circular sequences of reals On the discrepancy of circular sequences of reals Fan Chung Ron Graham Abstract In this paper we study a refined measure of the discrepancy of sequences of real numbers in [0, ] on a circle C of circumference.

More information

Number of occurrences of powers in strings

Number of occurrences of powers in strings Author manuscript, published in "International Journal of Foundations of Computer Science 21, 4 (2010) 535--547" DOI : 10.1142/S0129054110007416 Number of occurrences of powers in strings Maxime Crochemore

More information

Chung, F., P. Diaconis and R. Graham, Universal cycles for combinatorial structures, Discrete Mathematics 110 (1992) 43-59

Chung, F., P. Diaconis and R. Graham, Universal cycles for combinatorial structures, Discrete Mathematics 110 (1992) 43-59 Discrete Mathematics 110 (1992) 43-59 North-Holland 43 Universal structures cycles for combinatorial Fan Chung Bell Communications Research, Morristown, NJ 07960, USA Persi Diaconis Harvard University,

More information

De Bruijn Sequences for the Binary Strings with Maximum Density

De Bruijn Sequences for the Binary Strings with Maximum Density De Bruij Sequeces for the Biary Strigs with Maximum Desity Joe Sawada 1, Brett Steves 2, ad Aaro Williams 2 1 jsawada@uoguelph.ca School of Computer Sciece, Uiversity of Guelph, CANADA 2 brett@math.carleto.ca

More information

Algorithms for pattern involvement in permutations

Algorithms for pattern involvement in permutations Algorithms for pattern involvement in permutations M. H. Albert Department of Computer Science R. E. L. Aldred Department of Mathematics and Statistics M. D. Atkinson Department of Computer Science D.

More information

State Complexity of Neighbourhoods and Approximate Pattern Matching

State Complexity of Neighbourhoods and Approximate Pattern Matching State Complexity of Neighbourhoods and Approximate Pattern Matching Timothy Ng, David Rappaport, and Kai Salomaa School of Computing, Queen s University, Kingston, Ontario K7L 3N6, Canada {ng, daver, ksalomaa}@cs.queensu.ca

More information

Necklaces: Generalizations

Necklaces: Generalizations Necklaces: Generalizations V Ch Venkaiah V Ch Venkaiah is presently with the School of Computer and Information Sciences, University of Hyderabad. Prior to that he served in several organizations including

More information

Connectivity of Cayley Graphs: A Special Family

Connectivity of Cayley Graphs: A Special Family Connectivity of Cayley Graphs: A Special Family Joy Morris Department of Mathematics and Statistics Trent University Peterborough, Ont. K9J 7B8 January 12, 2004 1 Introduction Taking any finite group G,

More information

A ternary square-free sequence avoiding factors equivalent to abcacba

A ternary square-free sequence avoiding factors equivalent to abcacba A ternary square-free sequence avoiding factors equivalent to abcacba James Currie Department of Mathematics & Statistics University of Winnipeg Winnipeg, MB Canada R3B 2E9 j.currie@uwinnipeg.ca Submitted:

More information

Monotone Hamiltonian paths in the Boolean lattice of subsets

Monotone Hamiltonian paths in the Boolean lattice of subsets Monotone Hamiltonian paths in the Boolean lattice of subsets Csaba Biró and David Howard December 10, 2007 Abstract Consider the lattice whose elements are the subsets of the set of positive integers not

More information

Bounds on parameters of minimally non-linear patterns

Bounds on parameters of minimally non-linear patterns Bounds on parameters of minimally non-linear patterns P.A. CrowdMath Department of Mathematics Massachusetts Institute of Technology Massachusetts, U.S.A. crowdmath@artofproblemsolving.com Submitted: Jan

More information

Cross-Intersecting Sets of Vectors

Cross-Intersecting Sets of Vectors Cross-Intersecting Sets of Vectors János Pach Gábor Tardos Abstract Given a sequence of positive integers p = (p 1,..., p n ), let S p denote the set of all sequences of positive integers x = (x 1,...,

More information

Unrolling residues to avoid progressions

Unrolling residues to avoid progressions Unrolling residues to avoid progressions Steve Butler Ron Graham Linyuan Lu Mathematics is often described as the study of patterns, some of the most beautiful of which are periodic. In the integers these

More information

arxiv: v3 [cs.fl] 2 Jul 2018

arxiv: v3 [cs.fl] 2 Jul 2018 COMPLEXITY OF PREIMAGE PROBLEMS FOR DETERMINISTIC FINITE AUTOMATA MIKHAIL V. BERLINKOV arxiv:1704.08233v3 [cs.fl] 2 Jul 2018 Institute of Natural Sciences and Mathematics, Ural Federal University, Ekaterinburg,

More information

A Simple Left-to-Right Algorithm for Minimal Weight Signed Radix-r Representations

A Simple Left-to-Right Algorithm for Minimal Weight Signed Radix-r Representations A Simple Left-to-Right Algorithm for Minimal Weight Signed Radix-r Representations James A. Muir School of Computer Science Carleton University, Ottawa, Canada http://www.scs.carleton.ca/ jamuir 23 October

More information

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete CS125 Lecture 15 Fall 2016 15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete Already know SAT NP, so only need to show SAT is NP-hard. Let L be any language in NP. Let M be a NTM that decides L

More information

Constant Time Generation of Set Partitions

Constant Time Generation of Set Partitions 930 PAPER Special Section on Selected Papers from the 17th Workshop on Circuits and Systems in Karuizawa Constant Time Generation of Set Partitions Shin-ichiro KAWANO a) and Shin-ichi NAKANO b), Members

More information

FIBONACCI NUMBERS AND DECIMATION OF BINARY SEQUENCES

FIBONACCI NUMBERS AND DECIMATION OF BINARY SEQUENCES FIBONACCI NUMBERS AND DECIMATION OF BINARY SEQUENCES Jovan Dj. Golić Security Innovation, Telecom Italia Via Reiss Romoli 274, 10148 Turin, Italy (Submitted August 2004-Final Revision April 200) ABSTRACT

More information

Discrete Mathematics. Benny George K. September 22, 2011

Discrete Mathematics. Benny George K. September 22, 2011 Discrete Mathematics Benny George K Department of Computer Science and Engineering Indian Institute of Technology Guwahati ben@iitg.ernet.in September 22, 2011 Set Theory Elementary Concepts Let A and

More information

Monotone Gray Codes and the Middle Levels Problem

Monotone Gray Codes and the Middle Levels Problem Monotone Gray Codes and the Middle Levels Problem Carla D. Savage Department of Computer Science North Carolina State University Raleigh, North Carolina 27695-8206 cds@adm.csc.ncsu.edu Peter Winkler Bellcore

More information

Constructions for Higher Dimensional Perfect Multifactors

Constructions for Higher Dimensional Perfect Multifactors Constructions for Higher Dimensional Perfect Multifactors Garth Isaak AMS subject 05B99 (94A55) keywords: de Bruijn cycles, perfect maps Abstract Perfect maps, factors and multifactors can be viewed as

More information

New lower bounds for hypergraph Ramsey numbers

New lower bounds for hypergraph Ramsey numbers New lower bounds for hypergraph Ramsey numbers Dhruv Mubayi Andrew Suk Abstract The Ramsey number r k (s, n) is the minimum N such that for every red-blue coloring of the k-tuples of {1,..., N}, there

More information

Lexicographic Flow. Dexter Kozen Department of Computer Science Cornell University Ithaca, New York , USA. June 25, 2009

Lexicographic Flow. Dexter Kozen Department of Computer Science Cornell University Ithaca, New York , USA. June 25, 2009 Lexicographic Flow Dexter Kozen Department of Computer Science Cornell University Ithaca, New York 14853-7501, USA June 25, 2009 Abstract The lexicographic flow problem is a flow problem in which the edges

More information

Asymptotics for minimal overlapping patterns for generalized Euler permutations, standard tableaux of rectangular shapes, and column strict arrays

Asymptotics for minimal overlapping patterns for generalized Euler permutations, standard tableaux of rectangular shapes, and column strict arrays Discrete Mathematics and Theoretical Computer Science DMTCS vol. 8:, 06, #6 arxiv:50.0890v4 [math.co] 6 May 06 Asymptotics for minimal overlapping patterns for generalized Euler permutations, standard

More information

Hadamard matrices of order 32

Hadamard matrices of order 32 Hadamard matrices of order 32 H. Kharaghani a,1 B. Tayfeh-Rezaie b a Department of Mathematics and Computer Science, University of Lethbridge, Lethbridge, Alberta, T1K3M4, Canada b School of Mathematics,

More information

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard

More information