DeepAI AI Chat
Log In Sign Up

An algorithm for generating random mixed-arity trees

by   Aleksander Kiryk, et al.

Inspired by [4] we present a new algorithm for uniformly random generation of ordered trees in which all occuring outdegrees can be specified by a given sequence of numbers. The method can be used for random generation of binary or n-ary trees, or ones with various arities. We show that the algorithm is correct and has O(n) time complexity for n being the desired number of nodes in the resulting tree. In the discussion part we show how some selected formulas can be derived with the use of ideas developed in the proof of correctness of the algorithm.


page 1

page 2

page 3

page 4


Linear random generation of Motzkin trees

Motzkin trees are also called unary-binary trees. This paper proposes a ...

On the Collection of Fringe Subtrees in Random Binary Trees

A fringe subtree of a rooted tree is a subtree consisting of one of the ...

A One-to-One Correspondence between Natural Numbers and Binary Trees

A characterization is provided for each natural number except one (1) by...

Fast Generation of Big Random Binary Trees

random_tree() is a linear time and space C++ implementation able to crea...

A Gray Code of Ordered Trees

A combinatorial Gray code for a set of combinatorial objects is a sequen...

Uniform random generations and rejection method(I) with binomial majorant

We present three simple algorithms to uniformly generate `Fibonacci word...

Fast Generation of Unlabelled Free Trees using Weight Sequences

In this paper, we introduce a new representation for ordered trees, the ...