Generating binary trees of bounded height

SummaryWe present a new encoding scheme for binary trees with n internal nodes whose heights are bounded by a given value h, h≧⌈log2(n +1)1⌉. The scheme encodes the internal nodes of the tree level by level and enables us to develop an algorithm for generating all binary trees within this class in a certain predetermined order. Specifically, the trees are generated in decreasing height and for trees of the same height they are generated in lexicographically increasing order. The algorithm can be easily generalized to encompass t-ary trees with bounded height. It is then shown that the average generation time per tree is constant (independent of n and h).

[1]  Chak-Kuen Wong,et al.  Ranking and Unranking of B-Trees , 1983, J. Algorithms.

[2]  Andrzej Proskurowski On the Generation of Binary Trees , 1980, JACM.

[3]  H. Wilf A unified setting for sequencing, ranking, and selection algorithms for combinatorial objects , 1977 .

[4]  Marvin H. Solomon,et al.  A Note on Enumerating Binary Trees , 1980, JACM.

[5]  S. G. Williamson,et al.  On the ordering, ranking, and random generation of basic combinatorial sets , 1977 .

[6]  Gary D. Knott,et al.  A numbering system for binary trees , 1977, CACM.

[7]  Frank Ruskey Generating t-ary Trees Lexicographically , 1978, SIAM J. Comput..

[8]  C. K. Wong,et al.  Ranking and Unranking of 2-3 Trees , 1982, SIAM J. Comput..

[9]  Frank Ruskey,et al.  Generating Binary Trees Lexicographically , 1977, SIAM J. Comput..

[10]  Shmuel Zaks,et al.  Generating Trees and Other Combinatorial Objects Lexicographically , 1979, SIAM J. Comput..

[11]  Doron Rotem,et al.  Generation of Binary Trees from Ballot Sequences , 1978, JACM.

[12]  Sandra Mitchell Hedetniemi,et al.  Constant Time Generation of Rooted Trees , 1980, SIAM J. Comput..

[13]  Shmuel Zaks,et al.  Lexicographic Generation of Ordered Trees , 1980, Theor. Comput. Sci..

[14]  Anthony E. Trojanowski Ranking and Listing Algorithms for k-ary Trees , 1978, SIAM J. Comput..

[15]  A. Odlyzko,et al.  Limit distributions for coefficients of iterates of polynomials with applications to combinatorial enumerations , 1984, Mathematical Proceedings of the Cambridge Philosophical Society.

[16]  Shmuel Zaks,et al.  Generation and Ranking of k-ary Trees , 1982, Inf. Process. Lett..