On the average oscillation of a stack


Evaluating a binary tree in postorder we assume that in one unit of time zero or two nodes are removed from the top of the stack and one node is stored in the stack. The oscillation of the stack can be described by a functionf wheref(t) is the number of nodes in the stack aftert units of time.

In this paper we shall first derive several new enumeration results concerning planted plane trees. In the second part we shall prove, that the average number of maxima (MAX-turns) and minima (MIN-turns) of the functionf isn/2 andn/2—1, respectively, provided that all binary trees withn leaves are equally likely. Finally, we shall compute for largen and fixedj the average increase (decrease) of the length of the stack between thej-th MIN-turn and (j+1)-th MAX-turn (between thej-th MAX-turn and thej-th MIN-turn). This result implies that the average oscillation of the stack can be described by the functionf(j)=4√j/π−(−1)j+O(1/√j) for largen and fixed turn-numberj.

This is a preview of subscription content, access via your institution.


  1. [1]

    M. Abramowitz andI. A. Stegun,Handbook of mathematical functions, New York, Dover Publications (1970).

    Google Scholar 

  2. [2]

    L. Comtet,Advanced combinatorics, Dordrecht-Holland/Boston—U.S.A., D. Reidel Publishing Company (1974).

    Google Scholar 

  3. [3]

    N. G. De Bruijn, D. E. Knuth andS. O. Rice, The average height of planted plane trees, in:Graph theory and computing (R. C. Read, ed.), Academic Press, New York—London, (1972) 15–22.

    Google Scholar 

  4. [4]

    Dershowitz andZaks, Enumerations of Ordered Trees.Discrete Math. 31 (1980), 9–28.

    MATH  Article  MathSciNet  Google Scholar 

  5. [5]

    P. Flajolet andA. Odlyzko, The Average Height of Binary Trees and Other Simple Trees,preliminary report (INRIA), Paris, (1980).

    Google Scholar 

  6. [6]

    T. E. Harris, First passage and recurrence distributions.Trans. Amer. Math. Soc. 73, (1952) 471–486.

    MATH  Article  MathSciNet  Google Scholar 

  7. [7]

    P. Henrici,Applied and computational complex analysis, Vol. 2, John Wiley & Sons New York—London—Sydney—Toronto (1977).

    Google Scholar 

  8. [8]

    R. Kemp, On the average stack size of regularly distributed binary trees, In:Proc. of the sixth international colloquium on automata, languages and programming (ICALP 79), Springer Berlin—Heidelberg—New York 1979, 340–355.

    Google Scholar 

  9. [9]

    R. Kemp, The average height ofr-tuply rooted planted plane trees.Computing 25, (1980) 209–232.

    MATH  Article  MathSciNet  Google Scholar 

  10. [10]

    R. Kemp, A note on the stack size of regularly distributed binary trees.BIT 20, (1980), 157–163.

    MATH  Article  MathSciNet  Google Scholar 

  11. [11]

    D. E. Knuth,The art of computer programming, Vol. 1, 2nd ed., Addison Wesley Reading, Mass. (1973).

  12. [12]

    G. Kreweras, Sur les éventails de segments.Cahiers du B.U.R.O. 15 (1970), 1–41.

    Google Scholar 

  13. [13]

    T. V. Narayana andY. S. Sathe, Minimum variance unbiased estimation in coin tossing problems.Sankhya A 23, 2, (1961), 183–186.

    MATH  MathSciNet  Google Scholar 

  14. [14]

    J. Riordan,Combinatorial identities. Wiley, New York, (1968).

    Google Scholar 

  15. [15]

    E. T. Whittaker andG. N. Watson,A course of modern analysis, 2nd ed., Cambridge University Press (1952).

Download references

Author information



Rights and permissions

Reprints and Permissions

About this article

Cite this article

Kemp, R. On the average oscillation of a stack. Combinatorica 2, 157–176 (1982). https://doi.org/10.1007/BF02579315

Download citation

AMS subject classification (1980)

  • 05 C 05
  • 68 E 10