# Count of full, binary trees with fixed number of leaves

How many ways is there to build an arithmetic expression with fixed number of terms and fixed order? Let’s assume we have only one distinct operation that is neither commutative nor associative. The problem can be reduced to the question of how many different, full, binary trees could be constructed with a fixed number of leaves.

Suppose we have a list of n elements which have to become leaves in a full, binary tree. The root could be chosen between each two sequential numbers. Thus, there is (n-1) different ways to choose the root. If the root is located after the i-th number, we can still construct the left child as a binary tree with i leaves and the right one with (n – i) leaves.

The formula for the number of different ways to construct a full, binary tree is

$\Phi(n) = \sum^{n-1}_{i=1}\Phi(i).\Phi(n-i)$

The first value for n=1 ist set to:

$\Phi(1) = 1$

Is there a closed formula for this function? Is it - maybe - a popular problem in the Graph Theory with known solutions?

-

There is a general algorithm that solves this kind of problem.

1. Calculate the first terms of your sequence by hand.
2. Plug them into Sloane's and see if it is a known sequence.

http://oeis.org?q=1%2C1%2C2%2C5%2C14&sort=0&fmt=0&language=english&go=Search

Here you see that your numbers are called Catalan numbers; they are extremely well-studied.

-
Amazing! Thanks a lot for the very handy site! –  Mouk Feb 25 '10 at 15:43
This is a very well-known enumeration problem. The number of full binary rooted trees with $n+1$ leaves is just the $n$-th Catalan number $$C_n = \frac{(2n)!}{(n+1)!n!}.$$