Generating a Cyclic 2-Gray Code for Lucas Words in Constant Amortized Time

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

Abstract

We present a two-stage algorithm to generate a cyclic 2-Gray code for Lucas words. The first step involves a simple recursive algorithm that generates a cyclic 2-Gray code for Fibonacci words starting with a 0, which are strings that avoid p consecutive ones starting with a 0. Then, by considering the first and last blocks of 1s and concatenating lists of Fibonacci words starting with a 0 of different length n, we construct the first cyclic 2-Gray code for Lucas words. By using a dynamic programming approach, our algorithm generates each Lucas word and Fibonacci word in constant amortized time per string, using O(n3) space. The algorithm can also be modified to produce the first efficient algorithm for generating q-decreasing sequences in constant amortized time per string, also using O(n3) space. Our work extends a previous result on generating a cyclic 2-Gray code for q-decreasing sequences [Conference proceeding: International Conference and Workshop on Algorithms and Computation (WALCOM), LNCS 14549:91-102, 2024].

Original languageEnglish
Title of host publication36th Annual Symposium on Combinatorial Pattern Matching, CPM 2025
EditorsPaola Bonizzoni, Veli Makinen
PublisherSchloss Dagstuhl- Leibniz-Zentrum fur Informatik GmbH, Dagstuhl Publishing
ISBN (Electronic)9783959773690
DOIs
Publication statusPublished - 10 Jun 2025
Event36th Annual Symposium on Combinatorial Pattern Matching, CPM 2025 - Milan, Italy
Duration: 17 Jun 202519 Jun 2025

Publication series

NameLeibniz International Proceedings in Informatics, LIPIcs
Volume331
ISSN (Print)1868-8969

Conference

Conference36th Annual Symposium on Combinatorial Pattern Matching, CPM 2025
Country/TerritoryItaly
CityMilan
Period17/06/2519/06/25

Keywords

  • CAT algorithm
  • Fibonacci sequence
  • Fibonacci word
  • Gray code
  • Lucas word
  • q-decreasing sequence

Cite this