The generation of binary trees as a numerical problem

  • Authors:
  • Renzo Sprugnoli

  • Affiliations:
  • Univ. degli Studi di Padova, Padua, Italy

  • Venue:
  • Journal of the ACM (JACM)
  • Year:
  • 1992

Quantified Score

Hi-index 0.00

Visualization

Abstract

The problem of generating random, uniformly distributed, binarytrees is considered. A closed formula that counts the number of treeshaving a left subtee with k-1 nodes k=1,2,...,n is found. By inverting the formula, random trees withn nodes are generated according to the appropriateprobability distribution, determining the number of nodes in the leftand right subtrees that can be generated recursively. The procedure isshown to run in time On, occupying an extra space in the order ofOn.