A random binary tree generator

  • Authors:
  • H. W. Martin;B. J. Orr

  • Affiliations:
  • Department of Computer Science and Mathematics, Northern Michigan University;Department of Computer Science and Mathematics, Northern Michigan University

  • Venue:
  • CSC '89 Proceedings of the 17th conference on ACM Annual Computer Science Conference
  • Year:
  • 1989

Quantified Score

Hi-index 0.00

Visualization

Abstract

Let B(N) denote the set of all binary trees that have N nodes. A procedure for randomly generating the trees in B(N) such that each tree is equally likely to occur, that is an unbiased random generator, is given which runs in O(N) time, requires very little storage, and uses a system of arithmetic no larger than is required to represent the number U itself. Previous unbiased random binary tree generators, based on inverse rank functions, ran in O(N log N) time and required multiple precision arithmetic capable of handling numbers of the order of magnitude of the cardinality of B(N).