Universal cycles for weight-range binary strings Joe Sawada 1⋆ , Aaron Williams 2⋆⋆ , and Dennis Wong 1⋆⋆⋆ 1 School of Computer Science, University of Guelph, Canada. 2 Department of Mathematics and Statistics, McGill University, Canada. Abstract. We present an efficient universal cycle construction for the set of binary strings of length n whose weight (number of 1s) are in the range c, c+1,...,d where 0 ≤ c<d ≤ n. The construction can be implemented to generate each character in constant amortized time using O(n) space which based on a simple lemma for gluing universal cycles together. The Gluing lemma can also be applied to construct universal cycles for other combinatorial objects including passwords and labeled graphs. 1 Introduction Let B(n) denote the set of all binary strings of length n.A universal cycle for a set S is a cyclic sequence u 1 u 2 ··· u |S| where each substring of length n corresponds to a unique object in S. When S = B(n) these sequences are commonly known as de Bruijn sequences [6, 7, 13] and efficient constructions are well known [10, 9, 16]. For example, the cyclic sequence 0000100110101111 is a universal cycle (de Bruijn sequence) for B(4); the 16 unique substrings of length 4 when the sequence is considered cyclicly are: 0000, 0001, 0010, 0100, 1001, 0011, 0110, 1101, 1010, 0101, 1011, 0111, 1111, 1110, 1100, 1000. Universal cycles have been studied for a variety of combinatorial objects including per- mutations, partitions, subsets, labeled graphs, various functions, and passwords [1, 3–5, 12, 14, 15, 17, 20]. In this paper we focus on the set B d c (n), which denotes the subset of B(n) con- taining strings with weight (number of 1s) in the range c, c +1,...,d, or in other words, the subset of B(n) containing strings with weight-range from c to d. As an example, B 3 2 (4) = {0011, 0101, 0110, 1001, 1010, 1100, 0111, 1011, 1101, 1110} and a universal cycle for this set is 0011101011. Using standard techniques, it can be shown that universal cycles exist for all B d c (n) where 0 ≤ c<d ≤ n. When c = d, they exist only when c ∈{0, 1,n − 1,n}. However, finding efficient constructions remains a difficult problem. In this paper, a universal cycle has an efficient construction if each successive symbol of the sequence can be generated in constant amortized time (CAT) while using a polynomial amount of space with respect to the objects in the sequence. By constant amortized time we mean amortized O(1)-time, where the constant does not depend on the size of the objects in the sequence. Some special cases have been previously studied: – if c = d − 1 , then an efficient construction is known [19], – if c =0 or d = n, then an efficient construction is known [23], ⋆ Research supported by NSERC. email: jsawada@uoguelph.ca ⋆⋆ email: haron@uvic.ca ⋆⋆⋆ email: cwong@uoguelph.ca