Greedy Gray Codes for some Restricted Classes of Binary Words

Nathanaël Hassler,Vincent Vajnovszki,Dennis Wong
DOI: https://doi.org/10.4204/EPTCS.403.23
2024-06-24
Abstract:We investigate the existence of greedy Gray codes, based on the choice of the first element in the code, for two classes of binary words: generalized Fibonacci words and generalized Dyck words.
Discrete Mathematics,Data Structures and Algorithms,Combinatorics
What problem does this paper attempt to address?
The problem that this paper attempts to solve is about the existence of greedy Gray codes for certain restricted classes of binary words. Specifically, the author studies whether greedy Gray codes can be generated for two specific types of binary words, generalized Fibonacci words and generalized Dyck words, based on different ways of selecting the first element in the code. ### 1. Research Background #### 1.1 Restricted Binary Words - **Consecutive 1 - Restriction**: For given \( n, p\in\mathbb{N} \) (where \( p\geq2 \)), \( F_{n}(p) \) represents the set of binary words of length \( n \) in which there are no \( p \) consecutive 1s. In particular, \( F_{n}(2) \) is counted by the Fibonacci number \( f_{n} \), and in general, \( F_{n}(p) \) is counted by the \( p \)-th order Fibonacci number \( f_{n}^{(p)} \). - **Prefix - Restriction**: For given \( k, n, p\in\mathbb{N} \) (where \((p + 1)k\leq n\)), \( C_{n}(p,k) \) represents the set of binary words of length \( n \) with weight \( k \) (i.e., having exactly \( k \) 1s), and the number of 0s in any prefix is at least \( p \) times the number of 1s. #### 1.2 Gray Codes and Greedy Algorithms - **Gray Codes**: For a class of combinatorial objects, a Gray code is a list that contains each object in the class exactly once, and any two consecutive objects differ only under "small changes". This paper focuses on Gray codes of binary words with the same length and the same weight, and the "small change" refers to a homogeneous swap (i.e., swapping a 1 with a 0, with no other 1s between them). - **Greedy Algorithms**: The greedy Gray code algorithm starts from a specific binary word and gradually generates new words through homogeneous swaps until no new words can be generated. ### 2. Main Results #### 2.1 Fibonacci Words \( F_{n}(2,k) \) - For any \( \alpha\in F_{n}(2,k) \), applying the greedy algorithm can obtain a list of suffix partitions. - The author also characterizes the initial word \( \alpha \) that makes the greedy algorithm generate a complete list and determines the last word in the generated list. #### 2.2 General Case \( C_{n}(p,k) \) - For \( n\geq(p + 1)k \) and \( \alpha\in C_{n}(p,k) \), applying the greedy algorithm can obtain a list of suffix partitions. - The author further explores the cases of \( p\in\mathbb{N} \) and \( p\in\mathbb{R}^{+} \) and gives the conditions for the initial word \( \alpha \) to generate a complete list. ### 3. Conclusions The main contributions of this paper are: - Verifying the existence of greedy Gray codes under certain specific conditions. - Providing specific algorithms for generating these Gray codes. - Exploring the influence of different initial words on the generation results. Through these studies, the author provides a theoretical basis and practical methods for understanding and generating Gray codes of restricted classes of binary words.