Abstract

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.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.