Ranking and Loopless Generation of k-ary Dyck Words in Cool-lex Order
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).
KeywordsBinary String Gray Code Combinatorial Object Successor Rule Successive Object
Unable to display preview. Download preview PDF.
- 2.Heubach, S., Li, N.Y., Mansour, T.: A garden of k-Catalan structures (2008), http://www.scientificcommons.org/43469719
- 3.Knuth, D.E.: The Art of Computer Programming: Generating all Trees and History of Combinatorial Generation, vol. 4. Addison-Wesley (2006)Google Scholar
- 6.Ruskey, F., Sawada, J., Williams, A.: Binary bubble languages and cool-lex order, 13 pages (2010) (under review)Google Scholar
- 7.Ruskey, F., Williams, A.: Generating balanced parentheses and binary trees by prefix shifts. In: Proceedings of the 14th Computing: The Australasian Theory Symposium (CATS 2008), NSW, Australia, January 22-25, vol. 77, pp. 107–115 (2008)Google Scholar