On the average stack size of regularly distributed binary trees
The height of a tree with n nodes, that is the number of nodes on a maximal simple path starting at the root, is of interest in computing because it represents the maximum size of the stack used in algorithms that traverse the tree. In the classical paper of de Bruijn, Knuth and Rice, there is computed the average height of planted plane trees with n nodes assuming that all n-node trees are equally likely. The first section of this paper is devoted to the computation of the cumulative distribution function of this problem; we give an asymptotic equivalent in terms of familiar functions (Theorem 1). Then we derive an explicit expression and an asymptotic equivalent for the sth moment about origin of this distribution (Theorem 2). In the last section we compute the average stack size after t units of time during postorder-traversing of a binary tree with n leaves. Thereby, in one unit of time, a node is stored in the stack or is removed from the top of the stack.
Unable to display preview. Download preview PDF.
- 1 ABRAMOWITZ, M., STEGUN, I.A., Handbook of Mathematical Functions, Dover, New York, 1970Google Scholar
- 2 APOSTOL, T.M., Introduction to Analytic Number Theory, Springer-Verlag, New York, 1976Google Scholar
- 3 CARLITZ, L., ROSELLE, D.P., SCOVILLE, R.A., ‘Some Remarks on Ballot-Type Sequences of Positive Integers', J. Comb. Theory, Ser.A, 11, 258–271, 1971Google Scholar
- 4 CHANDRASEKHARAN, K., Arithmetical Functions, Die Grundlehren der Mathematischen Wissenschaften, Band 167, Springer-Verlag, 1970Google Scholar
- 5 DE BRUIJN, N.G., KNUTH, D.E., RICE, S.O., ‘The Average Height of Planted Plane Trees', in: Graph Theory and Computing, (R.C. Read, Ed.), 15–22, New York, London, Ac. Press, 1972Google Scholar
- 6 FELLER, W., An Introduction to Probability Theory and Its Application, vol. 1, 2.nd ed., Wiley, New York, 1957Google Scholar
- 7 FLAJOLET, PH., RAOULT, J.C., VUILLEMIN, J., ‘On the Average Number of Registers Required for Evaluating Arithmetic Expressions', IRIA, Rapport de Recherche, No. 228, 1977Google Scholar
- 8 KEMP, R., ‘The Average Number of Registers Needed to Evaluate a Binary Tree Optimally', appears in Acta Informatica, 1977Google Scholar
- 9 KNUTH, D.E., The Art of Computer Programming, vol. 1, second ed., Addison-Wesley, Reading, 1973Google Scholar
- 10 KREWERAS, G., ‘Sur les éventails de segments', Cahiers du B.U.R.O., 15, Paris, pp. 1–41, 1970Google Scholar
- 11 RIORDAN, J., An Introduction to Combinatorial Analysis, Wiley, New York, 1958Google Scholar
- 12 RIORDAN, J, Combinatorial Identities, Wiley, New York, 1968Google Scholar