Ranking and loopless generation of k-ary dyck words in cool-lex order

  • Authors:
  • Stephane Durocher;Pak Ching Li;Debajyoti Mondal;Aaron Williams

  • Affiliations:
  • Department of Computer Science, University of Manitoba, Canada;Department of Computer Science, University of Manitoba, Canada;Department of Computer Science, University of Manitoba, Canada;Department of Mathematics and Statistics, Carleton University, Canada

  • Venue:
  • IWOCA'11 Proceedings of the 22nd international conference on Combinatorial Algorithms
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

A binary string B of length n=kt is a k-ary Dyck word if it contains t copies of 1, and the number of 0s in every prefix of B is at most k−1 times the number of 1s. We provide two loopless algorithms for generating k-ary Dyck words in cool-lex order: (1) The first requires two index variables and assumes k is a constant; (2) The second requires t index variables and works for any k. We also efficiently rank k-ary Dyck words in cool-lex order. Our results generalize the “coolCat” algorithm by Ruskey and Williams (Generating balanced parentheses and binary trees by prefix shifts in CATS 2008) and provide the first loopless and ranking applications of the general cool-lex Gray code by Ruskey, Sawada, and Williams (Binary bubble languages and cool-lex order under review).