Abstract
P-sequences are used for coding binary trees and they are also an alternative representation for well-formed parentheses strings. We present here the first Gray code and loopless generating algorithm for P-sequences, and extend them in a Gray code and a new loopless generating algorithm for well-formed parentheses strings. Ranking and unranking algorithms are also discussed.
Article PDF
Similar content being viewed by others
Avoid common mistakes on your manuscript.
References
Ehrlich, G.: Loopless algorithms for generating permutations, combinations, and other combinatorial objects, J. ACM 20 (1973), 500–513.
Feller, W.: An Introduction to Probability Theory and its Applications, 2nd edn, Wiley, New York, 1971.
Mikawa, K. and Takaoka, T.: Generation of parenthesis strings by transpositions, In: Proc. CATS'97, Sydney, Australia, February 3-4, 1997.
Pallo, J. M. and Racca, R.: A note on generating binary trees in A-order and B-order, Internat. J. Comput. Math. 18(1) (1985), 27–39.
Proskurowski, A. and Ruskey, F.: Binary tree Gray codes, J. Algorithms 6 (1985), 225–238.
Roelants van Baronaigien, D.: A loopless Gray-code algorithm for listing k-ary trees, J. Algorithms 35(1) (2000), 100–107.
Ruskey, F. and Proskurowski, A.: Generating binary trees by transpositions, J. Algorithms 11 (1990), 68–84.
Vajnovszki, V.: Loopless algorithm for generating well-formed parentheses strings, Research Report Department IEM, University of Burgundy, Sept., 1997.
Vajnovszki, V.: On the loopless generation of binary tree sequences, Internat. Process. Lett. 68 (1998), 113–117. GENERATING A GRAY CODE FOR P-SEQUENCES 41
Walsh, T. R.: Generation of well-formed parenthesis strings in constant worst-case time, J. Algorithms 29(1) (1998), 651–673.
Walsh, T. R.: Loop-free sequencing of bounded integer compositions, J. Combin. Math. Combin. Comput. 33 (2000), 323–345.
Williamson, S. G.: Combinatorics for Computer Science, Computer Science Press, Rockville, Maryland, 1985.
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Vajnovszki, V. Generating a Gray Code for P-Sequences. Journal of Mathematical Modelling and Algorithms 1, 31–41 (2002). https://doi.org/10.1023/A:1015622720041
Issue Date:
DOI: https://doi.org/10.1023/A:1015622720041