A binary string B of length n = k t 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). © 2011 Springer-Verlag.
CITATION STYLE
Durocher, S., Li, P. C., Mondal, D., & Williams, A. (2011). Ranking and loopless generation of k-ary Dyck words in cool-lex order. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 7056 LNCS, pp. 182–194). https://doi.org/10.1007/978-3-642-25011-8_15
Mendeley helps you to discover research relevant for your work.