On the exhaustive generation of generalized ballot sequences in lexicographic and Gray code order

Abstract A generalized (resp. p-ary) ballot sequence is a sequence over the set of non-negative integers (resp. integers less than p) where in any of its prefixes each positive integer i occurs at most as often as any integer less than i. We show that the Reected Gray Code order induces a cyclic 3-adjacent Gray code on both, the set of fixed length generalized ballot sequences and p-ary ballot sequences when p is even, that is, ordered list where consecutive sequences (regarding the list cyclically) differ in at most 3 adjacent positions. Non-trivial efficient generating algorithms for these ballot sequences, in lexicographic order and for the obtained Gray codes, are also presented.

[1]  Rémi Vernay,et al.  Restricted compositions and permutations: From old to new Gray codes , 2011, Inf. Process. Lett..

[2]  Danna Zhou,et al.  d. , 1934, Microbial pathogenesis.

[3]  Vincent Vajnovszki,et al.  More Restricted Growth Functions: Gray Codes and Exhaustive Generation , 2017, Graphs Comb..

[4]  Frank Ruskey,et al.  On Rotations and the Generation of Binary Trees , 1993, J. Algorithms.

[5]  Bruce E. Sagan,et al.  The symmetric group - representations, combinatorial algorithms, and symmetric functions , 2001, Wadsworth & Brooks / Cole mathematics series.

[6]  Vincent Vajnovszki More restrictive Gray codes for necklaces and Lyndon words , 2008, Inf. Process. Lett..

[7]  Vincent Vajnovszki,et al.  Exhaustive generation for ballot sequences in lexicographic and Gray code order , 2018, GASCom.

[8]  Antonio Bernini,et al.  Gray code orders for $$q$$q-ary words avoiding a given factor , 2015, Acta Informatica.

[9]  Timothy Walsh,et al.  Generating Gray Codes in O(1) Worst-Case Time per Word , 2003, DMTCS.

[10]  Charalambos A. Charalambides,et al.  Enumerative combinatorics , 2018, SIGA.

[11]  Vincent Vajnovszki A Loopless Generation of Bitstrings without p Consecutive Ones , 2001, DMTCS.

[12]  M. C. Er,et al.  On Generating the N-ary Reflected Gray Codes , 1984, IEEE Transactions on Computers.

[13]  Marc Renault,et al.  Lost (and Found) in Translation: André's Actual Method and Its Application to the Generalized Ballot Problem , 2008, Am. Math. Mon..

[14]  Paul Klingsberg,et al.  A Gray Code for Compositions , 1982, J. Algorithms.

[15]  Vincent Vajnovszki,et al.  Two Reflected Gray Code-Based Orders on Some Restricted Growth Sequences , 2015, Comput. J..