# Counting trees (order matters)

As a follow up to this question (the number of rooted binary trees of size n), how many possible binary trees can you have if the nodes are now labeled, so that abc is different than bac cab etc ? In other words, order matters. Certainly it will be much more than the Catalan number.

What would the problem be if you have n-ary trees instead of binary ?

Are these known problems? reference ?

I am not sure, if I understood the question correctly, but are you asking for the number of rooted binary trees of size $n$, with nodes labeled from $1,...,n$, where isomorphic trees with different labelings are counted as different?
If so, isn't your labeling just adding $n!$ different possible labelings for each class of isomorphic trees? I.e. your total number of trees would be $n!C_n$, where $C_n$ is the $n$-th Catalan number.
• If you mean with $k$-ary tree trees where every node has at most $k$ children, then no, I don't think that there is a bijection between the set of binary trees of size $n$ to the set of $k$-ary trees of size $n$, $k>2$. Simply because any binary tree is also a $k$-ary tree. – Syzygy May 9 '12 at 23:24
• @user1419 $n! C_n = (2n)!/(n+1)! = (n+2)(n+3)\cdots(2n-1)(2n)$. – Gilles 'SO- stop being evil' May 11 '12 at 0:19
As partially answered above by Syzygy, for labelled binary trees, it is $n!C_n$, where $C_n$ being the Catalan number. Generalized this to labelled $k$-ary trees, it is $n!C^k_n$ where $C^k_n$ is the Fuzz-Catalan number $$$C^k_n= \binom{kn}{n}\frac{1}{(k-1)n+1}$$$