A Decomposition Algorithm for Noncrossing Trees

Based on the classic bijective algorithm for trees due to Chen, we present a decomposition algorithm for noncrossing trees. This leads to a combinatorial interpretation of a formula on noncrossing trees of size n with k descents. We also derive the formula for noncrossing trees of size n with k descents and i leaves, which is a refinement of the formula given by Flajolet and Noy. As an application of our algorithm , we answer a question proposed by Hough, which asks for a bijection between two classes of noncrossing trees with a given number of descents.


Introduction
A noncrossing tree (NC-tree for short) is a tree drawn on n points numbered in counterclockwise order on a circle in such a way that its edges are rectilinear and do not cross.We always consider the points labeled counterclockwise from 1 to n and the root labeled 1.The size of a NC-tree is defined as the number of edges.It is well known that the number of NC-trees of size n equals 1 2n+1 3n n , the generalized Catalan number.Noncrossing configurations have been extensively studied, see, for example, [1,3,[5][6][7][8][9][10][11]13].In a NC-tree T , a vertex v is planted at u if (u, v) is an edge and u lies on the unique path from the root to v.Moreover, (u, v) is a descent if u > v. Denote N n,k the number of NC-trees of size n with k descents.Using generating function, Hough [8] pointed out the following formula Theorem 1.1 (Theorem 2.2, [8]).
In this paper, we give a combinatorial interpretation of formula (1.1) by introducing a decomposition algorithm for NC-trees.Moreover, we derive a refined formula on NC-trees of size n with respect to the number of descents and the number of leaves.Notice that this formula is also a refinement of a result given by Flajolet and Noy [6].The second result of this paper is to provide a bijective proof for Question 1.2.Our combinatorial interpretation of formula (1.1) relies on the (l; r)-representation of NC-trees introduced by Panholzer and Prodinger [11].Represent a NC-tree T by a plane tree with each edge labeled by l or r using the following rules: Label an edge by l if it is a descent; Otherwise, label it by r.See Figure 1 for the (l; r)-representation of a NC-tree.Briefly, we call an edge labeled by l or r an l-edge or an r-edge respectively.It is obvious that a plane tree obtained in this way has two properties: (i) the edges adjacent to the root are always r-edges; (ii) for any internal vertex v, the vertices planted at v with l-edges are always to the left of the vertices planted at v with r-edges.In addition, these two properties provide a necessary and sufficient condition for a plane tree to become a NCtree.Note that each l-edge in such a plane tree corresponds to a descent.To construct the decomposition algorithm, we still need the notion of labeled NC-trees.A labeled NC-tree of size n is referred to the (l; r)-representation of a NC-tree of size n with the label set [n + 1] := {1, 2, . . ., n + 1}.See Figure 2 for a labeled NC-tree.Clearly, the number of labeled NC-trees of size n equals (n + 1)! times the number of NC-trees of size n.

A decomposition algorithm for labeled NC-trees
The purpose of this section is to give a decomposition algorithm for labeled NC-trees that leads to a combinatorial interpretation of formula (1.1).Our algorithm is a generalization of the bijective algorithm for plane trees in [2].It should be pointed out that Chen [2] established a more general bijection for trees.
A planted tree is a rooted tree with root degree one, and a planted edge is the edge adjacent to the root.Define a planted tree r-unique if the planted edge is an r-edge and all the other edges are l-edges.
We begin to deal with a labeled NC-tree T of size n with k l-edges.Remind that the label set of T is [n + 1].The first procedure of our algorithm is to decompose T into a forest F on [2n − k], where F is composed of n − k r-unique planted trees.

Decomposition algorithm:
Step 1. Find an r-unique planted subtree of T with planted edge (u, v) such that v is the rightmost child of u and the original label i of u is the smallest.Then we may obtain an r-unique planted subtree with planted edge (u, v).
Step 2. Remove the r-unique planted subtree and relabel the vertex u by n + 2 in T .However, the original label i will be reused for later comparisons of vertices.
Step 3. Repeat the above steps for the remaining tree and subsequently supply n + 3, n + 4, . . ., 2n − k to relabel the encountered vertex u.where a match is a rooted tree with two vertices.
Step 4. Find an l-edge (u, v) such that v is the rightmost child of u, v is a leaf and the label i of u is the smallest.Then we obtain a match with root u.Step 5. Remove the match and relabel the vertex u by 2n − k + 1 in F .However, the label i is still used for later comparisons of vertices.
See Figure 3 (b) for an example of the second procedure.It is clear that for k = 0, the decomposition algorithm for a labeled NC-tree with k descents reduces to the algorithm for a plane tree introduced by Chen [2].We call a match labeled by r or l an r-match or l-match respectively.For k 1, the resulting n matches on [2n] have the following properties: A vertex labeled by a mark * or a mark # is called a * -marked or a #-marked vertex respectively.
Merging algorithm: Step 1. Find the tree T without r-edge and #-marked vertex, such that the root i of T is the smallest.
Step 2. Find the tree T # with the smallest #-marked vertex.Let j # be this marked vertex.
Step 3. If j # is the root of T # , then merge T with T # by identifying i and j # , put the subtrees of T to the right of T # , and keep i as the label of the combined vertex.This operation is called a horizontal merge.If j # appears as a leaf of T # , then replace j # by T in T # .This operation is called a vertical merge.See Figure 4.
Step 4. Repeat the above steps until no #-marked vertex left.
Step 5. Find the tree T without * -marked vertex and the root i of T is the smallest.
Step 6. Find the tree T * with the smallest * -marked vertex j * .If j * is the root of T * , then merge T with T * by applying the horizontal merge.If j * appears as a leaf of T * , then merge T with T * by applying the vertical merge.
Step 7. Repeat Step 5 and Step 6 until we get a labeled NC-tree.Relying on the above algorithms, we arrive at the following result.
Theorem 2.1.The decomposition algorithm and the merging algorithm are inverse to each other.Consequently, for k 1, there is a bijection between the set of labeled NCtrees of size n with k descents and the set M n,k .
The proof of Theorem 2.1 is elementary but tedious, and we present it in Appendix A.
Combinatorial proof of Theorem 1.1.A NC-tree of size n with 0 descent reduces to a plane tree with n edges.It is well known that the set of plane trees of n edges is counted by the n-th Catalan number, see, for example, [12].Hence, the formula (1.1) is clear.We only need to confirm (1.1) for k 1. Keep in mind that the number of labeled NC-trees of size n with k descents equals (n + 1)! times the number of NC-trees of size n with k descents.By Theorem 2.1, it is equivalent to prove the following expression Note that the set of matches in M n,k satisfies conditions (A1)-(A3).Formula (2.1) holds since (i) there are 2n−k n−k ways to choose n − k labels from [2n − k] for the roots of rmatches, (ii) there are n−k 1 ways to choose a label to match 2n for an r-match, (iii) there are n+k−1 k ways to choose k labels from the remaining label set for the roots of l-matches, and (iv) there are (n − 1)! ways to arrange the remaining labels for the leaves of the matches.This gives the number which equals the right hand side of (2.1).
Observe that in the merging algorithm, a leaf with an unmarked label in M is still a leaf in the corresponding labeled NC-tree.We may derive a refined formula on NC-trees with respect to the number of descents and the number of leaves.Theorem 2.2.For k 1, the number of NC-trees of size n with k descents and i leaves is equal to Proof.The proof is similar as Theorem 1.1, and we give a sketch.Note that a labeled NC-tree of size n with k descents and i leaves corresponds to a set of n matches M ∈ M n,k with i unmarked leaves.Consider the set of M in M n,k with exactly i unmarked leaves and t r-matches with unmarked roots, which is counted by By summing over t, we derive that the number of labeled NC-trees of size n with k descents and i leaves is

This implies expression (2.2).
the electronic journal of combinatorics 21(1) (2014), #P1.5 We remark that for k = 0, the number of NC-trees of size n with k descents and i leaves is given by the Narayana number, see [4].The formula (2.2) is also a refinement of a formula obtained by Flajolet and Noy [6, Theorem 1].
By arranging the matches in M ∈ M n,k in terms of the increasing order of their leaves, we obtain a sequence on the roots of these n matches.Assume that the label for the root of an r-match is colored white, while the label for the root of an l-match is colored black and written in boldface.Therefore, M can be represented by a bicolored sequence consisting of n distinct integers such that (B1) there are n − k white elements that belong to the set [2n − k], (B2) there are k black elements that belong to the set [2n − 1], (B3) the last element is white.
Denote P n,k the set of bicolored sequences satisfying conditions (B1)-(B3).It is straightforward to obtain the following correspondence between labeled NC-trees and the bicolored sequences.
Theorem 2.3.For k 1, there is a bijection between labeled NC-tree of size n with k descents and the set P n,k .

A bijective proof of Question 1.2
In this section we present a bijective proof of Question 1.2.To describe our bijection, we first notice that it is equivalent to construct a bijection between the set of labeled NC-trees of size 2k + 1 with k l-edges and the set of labeled NC-trees of size 2k + 1 with k − 1 l-edges.Using Theorem 2.3, it remains to give a one-to-one correspondence between P 2k+1,k and P 2k+1,k−1 .
Let A 2k+1,k denote the set of bicolored sequences π in P 2k+1,k such that a white element i is underlined and a black element j is double underlined.For example, (16, 9, 8, 13, 21, 12, 7, 5, 14, 18, 17) belongs to A 11,5 .By definition, we have Let B 2k+1,k−1 be the set of bicolored sequences σ in P 2k+1,k−1 such that (i) a white element i is underlined, (ii) a white element j different from i is double underlined, (iii) neither i nor j is the last white element in σ.We proceed to construct a bijection Φ : A 2k+1,k → B 2k+1,k−1 , which relies on the partition of A 2k+1,k and B 2k+1,k−1 .Without loss of generality, we may assume that the elements in an integer set are arranged in the increasing order.As mentioned above, the underlined and double underlined elements are always denoted by i and j respectively.Now we need to consider five cases.Case 1. φ 1 : S 1 → T 1 , where • S 1 is the set of bicolored sequences π in A 2k+1,k such that i is not the last white element and j < 3k + 3, • T 1 is the set of bicolored sequences σ in B 2k+1,k−1 such that 3k + 3 is not a white element in σ.
For π ∈ S 3 , assume that j is the m-th black element in π.This implies that 1 m k.Then φ 3 (π) can be generated from π by the following procedures: Step 1. Remove the double underline from j to the m-th white element; Step 2. Change the black element 3k + 3 to a white element 3k + 3; Step 3. Exchange the positions of 3k + 3 and i, where i is still underlined.
For π ∈ S 4 , φ 4 (π) can be generated from π by the following procedures: Step 1. Remove the double underline from j to the m-th white element; Step 2. Replace the black element j by a white element 3k + 3; Step 3. Remove the underline from i to 3k + 3. • S 5 is the set of bicolored sequences π in A 2k+1,k such that 3k + 3 is an element in π, i is not the last white element and j > 3k + 3, • S 6 is the set of bicolored sequences π in A 2k+1,k such that 3k + 3 is not an element in π, i is not the last white element and j > 3k + 3, • S 7 is the set of bicolored sequences π in A 2k+1,k such that • T 5 is the set of bicolored sequences σ in B 2k+1,k−1 such that 3k + 3 is a white element but not the last in σ, i < 3k + 3 and j < 3k + 3.
For π ∈ S 5 ∪ S 6 ∪ S 7 , we have the following three cases.
the electronic journal of combinatorics 21(1) (2014), #P1.5 1.If π ∈ S 5 , assume that j is m-th element in π greater than 3k + 3. Then φ 5 (π) can be generated from π by the following procedures: Step 1. Change the black element 3k + 3 to a white element 3k + 3; Step 2. Remove the double underline from j to the m-th white element, except for i and 3k + 3.
2. If π ∈ S 6 , let B denote the set of elements in π, except for j, greater than 3k + 3. Assume that j is the m-th element in the set {3k + 4, 3k + 5, . . ., 4k + 1} − B. Then φ 5 (π) can be generated from π by the following procedures: Step 1. Replace the black element j by a white element 3k + 3; Step 2. Remove the double underline to the (m + |B|)-th white element, except for i and 3k + 3.
It is easy to see that (i) S i ∩ S j = ∅ holds for 1 i = j 7, (ii) the electronic journal of combinatorics 21(1) (2014), #P1.5 This finishes the proof of Question 1.2.
We only prove Claim 1 for brevity and similarity.Set F ′ the corresponding forest by applying Step 1 -Step 4 of the merging algorithm to M .Note that any #-marked label in an r-match of M appears as a leaf.It follows that each r-match with #-marked label will be merged by adopting a vertical merge in the merging algorithm, and the resulting tree is an r-unique planted tree without #-marked label.This implies that F ′ is composed of r-unique planted trees.To verify Claim 1, it suffices to show that F ′ = F .Remind that the number of l-edges in F is k and the number of trees in F is n − k.We proceed by induction on the number k.
If k = 1, denote F by {T 1 , T 2 , . . ., T n−1 }, where T 1 contains the unique l-edge.It implies that T 1 is composed of two edges.More precisely, an l-edge is attached under an r-edge in T 1 .In addition, any of T 2 , . . ., T n−1 is an r-match.By applying Step 4 -Step 6 of the decomposition algorithm to F , we get M = {T 11 , T 12 , T 2 , . . ., T n−1 }, where T 11 and T 12 are the l-match and the r-match respectively decomposed from T 1 .Conversely, it is easy to see that (2n) # is the unique #-marked label in M and (2n) # appears as the leaf of T 12 .Thus, by applying Step 1 -Step 4 of the merging algorithm, T 11 will be merged with T 12 by a vertical merge.Clearly, this operation recovers F , that is, F ′ = F .
Assume that the result holds with k replaced by k − 1.Then if there are k l-edges in F , let (i, j) be the first edge decomposed from F at the first running of Step 4 -Step 6 in the decomposition algorithm.Notice that (i, j) is an l-edge, j is the rightmost child of i and j is a leaf.Let F 1 be the forest obtained from F by deleting the edge (i, j) and the vertex j.Besides, denote M 1 the corresponding set of matches by applying Step 4 -Step 6 of the decomposition algorithm to F 1 .One sees that there are k − 1 l-edges in F 1 .By the induction hypothesis, we can recover F 1 from M 1 by applying Step 1 -Step 4 of the merging algorithm.
In light of the decomposition algorithm, it is straightforward to derive the following relations between M and M 1 .
(1) (i, j) is an l-match in M but not in M 1 ; (2) The set of other matches in M is the same as M 1 if we replace the label (2n−k +1) # in M by i, and replace the #-marked labels in M 1 in increasing order by (2n−k+2) # , (2n − k + 3) # , . .., (2n) # respectively.
Observe that (i, j) is still the first edge encountered whenever applying the merging algorithm to M (This is implied by the fact that all the l-matches without #-marked vertex are obtained from those leaves that are the rightmost child.Among such matches, (i, j) has the smallest root label).Furthermore, the first merge step for M is the merging of the match (i, j) and the match with the label (2n − k + 1) # .Then clearly, the following merge steps are the same as those for M 1 .Moreover, at any step, j is always the rightmost child of i.The proofs of Claim 3 and Claim 4 are similar to that of Claim 1, and we only present a sketch for the proof of Claim 3. Set T ′ the corresponding tree by applying Step 5 - Step 7 of the merging algorithm to F .Since each tree in F is an r-unique planted tree, we eventually get a NC-tree T ′ by adopting merging algorithm.Now, it suffices to show T ′ = T .We proceed by induction on the number of r-edges in T .
If there is only one r-edge in T , T must be an r-unique planted tree.In terms of the decomposition algorithm, F contains a unique tree T .Hence, we can recover T from F trivially.
For a general labeled NC-tree T , let T be the first r-unique planted subtree of T encountered at the first running of Step 1 -Step 3 in the decomposition algorithm.Moreover, let (i, j) be the planted edge of T .Notice that (i, j) is an r-edge and j is the rightmost child of i.Let T 1 be the tree obtained from T by deleting T but keeping the vertex i.It is clear that the number of r-edges in T 1 decreases by 1. Denote F 1 the corresponding forest by applying Step 1 -Step 3 of the decomposition algorithm to T 1 .By the induction hypothesis, we can recover T 1 from F 1 by applying Step 5 -Step 7 of the merging algorithm.
One can check that the relations between F and F 1 are (1) T is an r-unique planted tree in F but not in F 1 ; (2) the set of other trees in F is the same as F 1 if we replace the labels (n + 2) * in F by i, and replace the * -marked labels in F 1 in increasing order by (n + 3) * , (n + 4) * , . .., (2n − k) * respectively.
In addition, T is still the first tree encountered whenever applying the merging algorithm to F .Furthermore, the first merge step for F is the merging of T and the tree with the label (n + 2) * .After that, the merge steps are the same as those for F 1 .Finally, T ′ can be obtained from T 1 by combining the vertex i of T 1 and the vertex i of T such that j is the rightmost child of i, which implies T ′ = T .

Figure 3 (
Figure 3 (a) is an illustration of the first procedure of the decomposition algorithm.The second procedure of our algorithm is to decompose F into a set M of n matches on [2n],where a match is a rooted tree with two vertices.

6 Figure 3 :
Figure 3: The decomposition algorithm of a labeled NC-tree.

Figure 4 :
Figure 4: A horizontal merge and a vertical merge.

For
example, π = (16, 9, 8, 13, 12, 19, 3, 2, 14, 21, 17) is in A 11,5 .By definition, k = 5 and ([4k + 1] − E(π) − {3k + 3}) ∪ {j} = {1, 3, 4, 5, 6, 7, 10, 11, 15, 20}.It follows that m = 2 and 1 m k.One can verify that π belongs to S 4 .Then φ 4 (π) = (16, 9, 8, 13, 12, 19, 18, 2, 14, 21, 17).Case 5. φ 5 : S 5 ∪ S 6 ∪ S 7 → T 5 , where It follows that the forest F ′ , corresponding to M by Step 1 -Step 4 of the merging algorithm, can be obtained from F 1 by attaching a rightmost child j to i.This gives F ′ = F .Before the first running of Step 5 -Step 7 in the merging algorithm, there are n − k trees and n − k − 1 * -marked vertices in these trees.Thus there must be a tree without * -marked vertex.After each merge, both the number of trees and the number of * -marked vertices decrease by 1.It means that we can always find a tree without * -marked vertex at any step.Therefore, Step 5 -Step 7 in the merging algorithm are feasible.To complete the proof of Lemma .2, it remains to show that Claim 3. if F is a forest obtained from a tree T by applying Step 1 -Step 3 of the decomposition algorithm, then we can recover T from F by applying Step 5 -Step 7 of the merging algorithm; Claim 4. if T is a tree obtained from a forest F by applying Step 5 -Step 7 of the merging algorithm, then we can recover F from T by applying Step 1 -Step 3 of the decomposition algorithm.
The proof of Lemma .2.The feasibility of Step 1 -Step 3 in the decomposition algorithm is obvious.It is routine to check the feasibility of Step 5 -Step 7 in the merging algorithm.the electronic journal of combinatorics 21(1) (2014), #P1.5