[Template] Cattleya Number

ACM template


Proof of Catalan Number

1. Cattleya number recurrence:
an = {1, n = 0 ∑ i = 0 n − 1 ai × an − 1 − i, n> 0 a_n=\begin{cases} 1,n=0\\\ sum_{i=0}^{n-1}a_i×a_{n-1-i},n>0\end{cases}an={ 1,n=0i=0n1ai×an1i,n>0
2. Cattleya number combination:
an = C 2 nn − C 2 nn − 1 a_n=C_{2n}^n-C_{2n}^{n-1}an=C2 nnC2 nn1
Proof recursion

Let me give you an example. If you don’t have money, but you want to spend it, you can spend one yuan every time. As long as you have money, you can spend money continuously. Your parents are going to give you n yuan but only one yuan each time. Money, as long as you haven't given you n yuan, you can keep giving it. How many spending plans do you have?

As shown in the figure below, we let the parents give money to the representative to move one unit to the right, and spend money means that the previous unit is initially at the origin (you did not spend money, and your parents did not give you money). Finally, parents give us n yuan, and we spend n Yuan money. According to the actual situation, we can know that the money we spend must not exceed the money our parents give us. Abstract it now requires a path from (0,0) to (n,n) and the ordinate of all points on the path is less than or equal to the abscissa

Insert picture description here

Find the number of plans for a path from (0,0) to (n,n) : C 2 nn C_{2n}^nC2 nn

If a certain path is illegal, as shown in the black path above, the ordinate of the point on the path is greater than the abscissa, we find the first point that does not meet this condition, as shown in the orange point, which must fall on y = x + 1 y=x+1and=x+1 On this straight line, we will refer to the back part of the orange point of this illegal path abouty = x + 1 y = x+1and=x+1 Make symmetry, as shown in the yellow part, the end point must fall at(n − 1, n + 1) (n-1, n+1)(n1,n+1 ) . Therefore, the number of schemesfor findingan illegal path from (0,0) to (n,n) can be transformed into the number of schemes for a path from (0,0) to (n-1,n+1):C 2 nn − 1 C_{2n}^{n-1}C2 nn1

A path from (0,0) to (n,n) and the ordinate of all points on the path is less than or equal to the abscissa : C 2 nn − C 2 nn − 1 C_{2n}^{n}-C_{2n }^{n-1}C2 nnC2 nn1

Cattleya Number Application

  1. Push
  2. Bracket matching
  3. Draw a binary tree
  4. Convex polygon triangulation

Guess you like

Origin blog.csdn.net/Fighting_Peter/article/details/113010100