Descendants and ascendants in binary trees

There are three classical algorithms to visit all the nodes of a binary tree - preorder, inorder and postorder traversal. From this one gets a natural labelling of the n internal nodes of a binary tree by the numbers 1, 2, ..., n, indicating the sequence in which the nodes are visited. For given n (...

Full description

Bibliographic Details
Main Authors: Alois Panholzer, Helmut Prodinger
Format: Article
Language:English
Published: Discrete Mathematics & Theoretical Computer Science 1997-01-01
Series:Discrete Mathematics & Theoretical Computer Science
Subjects:
Online Access:https://dmtcs.episciences.org/246/pdf
_version_ 1827323963332624384
author Alois Panholzer
Helmut Prodinger
author_facet Alois Panholzer
Helmut Prodinger
author_sort Alois Panholzer
collection DOAJ
description There are three classical algorithms to visit all the nodes of a binary tree - preorder, inorder and postorder traversal. From this one gets a natural labelling of the n internal nodes of a binary tree by the numbers 1, 2, ..., n, indicating the sequence in which the nodes are visited. For given n (size of the tree) and j (a number between 1 and n), we consider the statistics number of ascendants of node j and number of descendants of node j. By appropriate trivariate generating functions, we are able to find explicit formulae for the expectation and the variance in all instances. The heavy computations that are necessary are facilitated by MAPLE and Zeilberger's algorithm. A similar problem comes fromlabelling the leaves from left to right by 1, 2, ..., n and considering the statistic number of ascendants (=height) of leaf j. For this, Kirschenhofer [1] has computed the average. With our approach, we are also able to get the variance. In the last section, a table with asymptotic equivalents is provided for the reader's convenience.
first_indexed 2024-04-25T02:01:06Z
format Article
id doaj.art-d2840cd19366495ea60d2224396cb736
institution Directory Open Access Journal
issn 1365-8050
language English
last_indexed 2024-04-25T02:01:06Z
publishDate 1997-01-01
publisher Discrete Mathematics & Theoretical Computer Science
record_format Article
series Discrete Mathematics & Theoretical Computer Science
spelling doaj.art-d2840cd19366495ea60d2224396cb7362024-03-07T14:56:02ZengDiscrete Mathematics & Theoretical Computer ScienceDiscrete Mathematics & Theoretical Computer Science1365-80501997-01-01Vol. 110.46298/dmtcs.246246Descendants and ascendants in binary treesAlois Panholzer0Helmut Prodinger1Institut für Diskrete Mathematik und Geometrie [Wien]Institut für Diskrete Mathematik und Geometrie [Wien]There are three classical algorithms to visit all the nodes of a binary tree - preorder, inorder and postorder traversal. From this one gets a natural labelling of the n internal nodes of a binary tree by the numbers 1, 2, ..., n, indicating the sequence in which the nodes are visited. For given n (size of the tree) and j (a number between 1 and n), we consider the statistics number of ascendants of node j and number of descendants of node j. By appropriate trivariate generating functions, we are able to find explicit formulae for the expectation and the variance in all instances. The heavy computations that are necessary are facilitated by MAPLE and Zeilberger's algorithm. A similar problem comes fromlabelling the leaves from left to right by 1, 2, ..., n and considering the statistic number of ascendants (=height) of leaf j. For this, Kirschenhofer [1] has computed the average. With our approach, we are also able to get the variance. In the last section, a table with asymptotic equivalents is provided for the reader's convenience.https://dmtcs.episciences.org/246/pdfzeilberger's algorithmbinary treetree traversalgenerating function[info.info-dm] computer science [cs]/discrete mathematics [cs.dm]
spellingShingle Alois Panholzer
Helmut Prodinger
Descendants and ascendants in binary trees
Discrete Mathematics & Theoretical Computer Science
zeilberger's algorithm
binary tree
tree traversal
generating function
[info.info-dm] computer science [cs]/discrete mathematics [cs.dm]
title Descendants and ascendants in binary trees
title_full Descendants and ascendants in binary trees
title_fullStr Descendants and ascendants in binary trees
title_full_unstemmed Descendants and ascendants in binary trees
title_short Descendants and ascendants in binary trees
title_sort descendants and ascendants in binary trees
topic zeilberger's algorithm
binary tree
tree traversal
generating function
[info.info-dm] computer science [cs]/discrete mathematics [cs.dm]
url https://dmtcs.episciences.org/246/pdf
work_keys_str_mv AT aloispanholzer descendantsandascendantsinbinarytrees
AT helmutprodinger descendantsandascendantsinbinarytrees