Skip to main content
Log in

Generating binary trees of bounded height

  • Published:
Acta Informatica Aims and scope Submit manuscript

Summary

We 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).

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+
from €37.37 /Month
  • Starting from 10 chapters or articles per month
  • Access and download chapters and articles from more than 300k books and 2,500 journals
  • Cancel anytime
View plans

Buy Now

Price includes VAT (Netherlands)

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Beyer, T., Hedetniemi, S.M.: Constant time generation of rooted trees. SIAM J. Comput. 9, 706–712 (1980)

    Google Scholar 

  2. Gupta, U.I., Lee, D.T., Wong, C.K.: Ranking and unranking of 2–3 trees. SIAM J. Comput. 11, 582–590 (1982)

    Google Scholar 

  3. Gupta, U.I., Lee, D.T., Wong, C.K.: Ranking and unranking of B-trees, J. Algorithms 4, 11–60 (1983)

    Google Scholar 

  4. Flajolet, P., Odlyzko, A.: Limit distributions for coefficients of iterates of polynomials with applications to combinatorial enumerations. (AT & T Bell Laboratories (1983) unpublished)

  5. Knott, G.D.: A numbering system for binary trees. Commun. ACM 20, 113–115 (1977)

    Google Scholar 

  6. Proskurowski, A.: On the generation of binary trees, J. ACM 27, 1–2 (1980)

    Google Scholar 

  7. Rotem, D., Varol, Y.L.: Generation of binary trees from ballot sequences, J. ACM 25, 396–404 (1978)

    Google Scholar 

  8. Ruskey, F.: Generating t-ary trees lexicographically, SIAM J. Comput. 7, 424–439 (1978)

    Google Scholar 

  9. Ruskey, F., Hu, T.C.: Generating binary trees lexicographically. SIAM J. Comput. 6, 745–758 (1977)

    Google Scholar 

  10. Solomon, M., Finkel, R.A.: A note on enumerating binary trees. J. ACM 27, 3–5 (1980)

    Google Scholar 

  11. Trojanowski, A.E.: Ranking and listing algorithms for k-ary trees. SIAM J. Comput. 7, 492–509 (1978)

    Google Scholar 

  12. Wilf, H.S.: A unified setting for sequencing, ranking and selection algorithms for combinatorial objects. Adv. Math. 24, 281–291 (1977)

    Google Scholar 

  13. Williamson, S.G.: On the ordering, ranking and random generation of basic combinatorial sets, in Combinatoire et representation du groupe symetrique. Strasbourg: 1976

  14. Zaks, S.: Lexicographic generation of ordered trees. Theor. Comput. Sci. 10, 63–82 (1980)

    Google Scholar 

  15. Zaks, S., Richards, D.: Generating trees and other combinatorial objects lexicographically. SIAM J. Comput. 8, 73–81 (1979)

    Google Scholar 

  16. Zaks, S.: Generation and ranking of k-ary trees, Inf. Process. Lett. 14, 44–48 (1982)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Additional information

Supported in part by National Science Foundation under Grants MCS 8342682 and ECS 8340031

Rights and permissions

Reprints and permissions

About this article

Cite this article

Lee, C.C., Lee, D.T. & Wong, C.K. Generating binary trees of bounded height. Acta Informatica 23, 529–544 (1986). https://doi.org/10.1007/BF00288468

Download citation

  • Received:

  • Issue date:

  • DOI: https://doi.org/10.1007/BF00288468

Keywords