Acta Informatica

, Volume 11, Issue 4, pp 363–372 | Cite as

The average number of registers needed to evaluate a binary tree optimally

Article

Summary

In this paper we determine the number of binary trees with n leaves which can be evaluated optimally with less than or equal to k registers. Furthermore we obtain the result that this number is equal to the number of the binary trees with n leaves, using for traversal a maximum size of stack less than or equal to 2k+1−1. This fact is only a connection between the numbers of the trees and not between the sets of the trees. We compute also the average number ¯R(n) of registers needed to evaluate a binary tree optimally. We get for all ɛ>0: \(\bar R(n + 1) = 1d(\sqrt {n)} + C + F(n) + O(n^{ - 0.5 + \varepsilon } )\)where C = 0.82574... is a constant and F(n) is a function with F(n) = F(4n) for all n>0 and −0.574<F(n)< −0.492.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Chandrasekharan, K.: Arithmetical Functions, Band 167. Springer-Verlag 1970Google Scholar
  2. 2.
    deBruijn, N.G., Knuth, D.E., Rice, S.O.: The average height of planted plane trees. In: Graph Theory and Computing, (R.C. Read, Ed.), pp. 15–22. New York-London: Ac. Press 1972Google Scholar
  3. 3.
    deBruijn, N.G.: On Mahler's partition problem. Koninklijke Nederlandsche Akademie van Wetenschappen, Proceedings Vol. LI, No. 6, 659–669 (1948)Google Scholar
  4. 4.
    Kemp, R.: The average number of registers needed to evaluate a binary tree optimally. Technical Report A77/04, Universität des Saarlandes, Saarbrücken, 1977Google Scholar
  5. 5.
    Nakata, I.: On compiling algorithms for arithmetic expressions. Comm. ACM 10, 492–494 (1967)Google Scholar
  6. 6.
    Sethi, R., Ullman, J.D.: The generation of optimal code for arithmetic expressions. JACM 17, 715–728 (1970)Google Scholar

Copyright information

© Springer-Verlag 1979

Authors and Affiliations

  • R. Kemp
    • 1
  1. 1.Fachbereich Angewandte Mathematik und InformatikUniversität des SaarlandesSaarbrückenGermany (Fed. Rep.)

Personalised recommendations