Abstract
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).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Canfield, E., Williamson, S.: A loop-free algorithm for generating the linear extensions of a poset. Order 12, 57–75 (1995)
Heubach, S., Li, N.Y., Mansour, T.: A garden of k-Catalan structures (2008), http://www.scientificcommons.org/43469719
Knuth, D.E.: The Art of Computer Programming: Generating all Trees and History of Combinatorial Generation, vol. 4. Addison-Wesley (2006)
Pruesse, G., Ruskey, F.: Generating the linear extensions of certain posets by transpositions. SIAM Journal on Discrete Mathematics 4(3), 413–422 (1991)
Ruskey, F.: Generating t-ary trees lexicographically. SIAM Journal on Computing 7(4), 424–439 (1978)
Ruskey, F., Sawada, J., Williams, A.: Binary bubble languages and cool-lex order, 13 pages (2010) (under review)
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)
Trojanowski, A.E.: Ranking and listing algorithms for k-ary trees. SIAM Journal on Computing 7(4), 492–509 (1978)
Vajnovszki, V., Walsh, T.: A loop-free two-close Gray-code algorithm for listing k-ary Dyck words. Journal of Discrete Algorithms 4(4), 633–648 (2006)
Zaks, S.: Generation and ranking of k-ary trees. Information Processing Letters 14(1), 44–48 (1982)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Durocher, S., Li, P.C., Mondal, D., Williams, A. (2011). Ranking and Loopless Generation of k-ary Dyck Words in Cool-lex Order. In: Iliopoulos, C.S., Smyth, W.F. (eds) Combinatorial Algorithms. IWOCA 2011. Lecture Notes in Computer Science, vol 7056. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-25011-8_15
Download citation
DOI: https://doi.org/10.1007/978-3-642-25011-8_15
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-25010-1
Online ISBN: 978-3-642-25011-8
eBook Packages: Computer ScienceComputer Science (R0)