first, Catalan number of properties1.1 Order
h (0) =1,h (1) =1, the Catalan number satisfies the recursive type:
h (n) = h (0) *h (n-1) +h (1) *h (n-2) + ... + h (n-1) H (0) (n>=2)For example: H (2) =h (0) *h (1) +h (1) *h (0) =1*1+1*1=2h (3) =h (0) *h (2) +h (1) *h (1) +h (2) *h (0) =1*2+1*1+2*1=5 1.2 alternative recursion: H (n) =h (n-1) * ( n-2)/(n+1); 1.3 The solution of the recursive relationship is:
h (N) =c (2n,n)/(n+1) (n=0,1,2,...)1.4 Alternative solutions for recursive relationships are: H (n) =c (2n,n)-C (2n,n-1) (n=0,1,2,...)
ii. Proof of Catalan formula
2.1 using Raney proof 1.3
Raney lemma:
Set integer sequence a = {Ai, i=1, 2, ..., n}, and part and Sk=a1+...+ak, all the numbers in the sequence and sn=1, in the N loop representation of a, there is only one sequence B, satisfies any part of B and Si is greater than 0.
The Raney lemma proves to be able to know a little bit.
About Catalan number of wiki and encyclopedia written in very detailed, there is a problem of a stack (infinity) into the stack sequence of 1,2,3,...,n, how many different out of the stack sequence? The solution for this problem is H (n).
With 1 for a number in the stack, 1 for a number out of the stack, it is not difficult to see that the solution of the problem is equivalent to a sequence containing n 1 and N-1, and satisfies its arbitrary prefix and the number of permutations greater than or equal to 0. But this sequence is not the same as our Raney lemma requirement sequence, so we add a 1 to this sequence, namely (n+1) 1 and N-1 sequence a{2n+1}, now we can apply Raney lemma, a{2n+1} All possible permutations are C (2n+1,
n), and the loop of the different structure of the string is a division of the number of combinations, and then according to the Raney lemma known in a cyclic isomorphic equivalence class, only one string satisfies any prefix and greater than 0, so the number of permutations satisfying the condition is C (2n+1, N)/(2n+1), and because of any prefix and greater than 0, So the first bit can only be 1 instead of 1, so it can be concluded that after removing the first bit, the total number of a{2n} sequences satisfying any prefix and greater than >=0 is also C (2n+1, N)/(2n+1) =
C (2n, N)/(n+1), this is the general formula of Catalan.
2.2 Proof-Recursive 1.1
a stack (infinity) in the stack sequence is 1,2,3,...,n, how many different stack sequences?Proof: First of all, we set f (n) = sequence number of the number of sequences N of the sequence of the stack. (we assume that the element of the last stack is K, obviously, K to different values when the situation is independent, that is, to find out the number of each k the last stack after the use of the addition principle, because K finally out of the stack, so, before k into the stack, the value of a smaller than k is the stack, where the situation has F (k-1), and later than the value of K into the And all before k out of the stack, so there are f (n-k) way, because the smaller than K and greater than the value of K is independent of the stack, the multiplication principle can be used here, F (n-k) *f (k-1) species, sum is Catalan recursion. Ps.author Tao Heaps)Triangular division of convex PolygonIn a convex polygon, the polygon is divided into several triangles by a number of disjoint diagonal lines. The task is to enter the number of sides N of a convex polygon on the keyboard, and to find the number of different schemes F (n). For example, when N=6, f (6) = 14. Analysis if purely from F (4) =2,f (5) =5,f (6) =14,......,f (n) =n slowly to generalize, I am afraid it is difficult to find the recurrence of the problem, we must from the general situation to find the law. Because any edge of a convex polygon must belong to a certain triangle, we use a certain edge as the datum, with the two vertices of this edge as the starting point and the end Pn (p, P1), the vertices of the convex polygon are labeled as P1, P2 、......、 pn, Again in the convex polygon to find any one does not belong to these two points PK (2<=k<=n-1), to form a triangle, with this triangle to divide a convex polygon into two convex polygons, one of the convex polygon, is by P1,P2, ... The convex K-Side shape of Pk (the number of vertices is the number of sides), and the other convex polygon, is a convex n-k+1 shape formed by PK,PK+1,......,PN. At this point, if we consider PK as a certain point, then according to the multiplication principle, the problem of f (n) is equivalent to--convex K Polygon Division scheme number multiplied convex n-k+1 Polygon Division scheme number, namely chooses PK this vertex's f (n) =f (k) XF (n-k+1). and K can choose 2 to n-1, so according to the addition principle, k is divided into different values to add the scheme, the total number of programs are: F (n) =f (2) F (n-2+1) +f (3) F (n-3+1) +......+f (n-1) F (2). See here, and then look at the recursive Cattleya number, the answer is self-evident, that is f (n) =h (n-2) (n=2,3,4, ...). )。 Finally, make F (2) =1,f (3) = 1.
Three, Catalan number of applications
1, matrix chain multiplication: P=a1xa2xa3x......xan, according to the multiplication binding law, does not change its order, only uses the parentheses to represent the product of the pair, how many kinds of parentheses scheme?
Idea: This can be considered, first through the parentheses, the P is divided into two parts, and then the two parts are bracketed. For example, divide (A1) x (A2xa3.....xan) and then bracket (A1) and (A2xa3.....xan) separately, as well as divide (A1XA2) x (A3.....xan) and then bracket (A1XA2) and (A3.....xan).
The number of the parentheses scheme with n matrices is f (n), then the Jiewei of the problem
F (n) = f (1) *f (n-1) + f (2) *f (n-2) + f (3) *f (n-3) + f (n-1) *f (1). F (1) *f (n-1) is divided into two parts (A1) x (A2xa3.....xan) and then bracketed separately.
The calculation begins with a few items, f (1) = 1, f (2) = 1, f (3) = 2, f (4) = 5. Combined with recursion, it is not difficult to find F (n) equals H (n-1).
2, a stack (infinity) into the stack sequence is 1,2,3,...,n, how many different out of the stack sequence?
Idea: This is similar to parentheses, where the stack operation is equivalent to an opening parenthesis, and the stack operation is equivalent to a closing parenthesis. The order of the n number and the stack order form a sequence with 2n numbers. The No. 0 number must be the number of the stack, and the number corresponding to the stack must be the number of 2i+1. Because if it is 2i, then the middle contains an odd number of numbers, this odd number will certainly not constitute a stack out of the stack sequence.
The solution for the set problem is f (2n), then f (2n) = f (0) *f (2n-2) + f (2) *f (2n-4) + f (2n-2) *f (0). F (0) * F (2n-2) indicates that the No. 0 number is immediately out of the stack, when the number of the stack and out of the stack contains a number of 0, the remainder is the number of 2n-2. F (2) *f (2n-4) indicates that the NO. 0 digital stack and the stack contain 2 digits, equivalent to 1 2 2 1, and the remaining is 2n-4 digits. In turn.
Suppose f (0) = 1, calculate the start of several items, F (2) = 1, f (4) = 2, f (6) = 5. Combined with recursion, it is not difficult to find that f (2n) equals h (n).
3,n nodes constitute a two-fork tree, how many kinds of situation?
Thought: This can be considered, the root will definitely occupy a node, then the remaining n-1 nodes can have the following distribution, T (0, n-1), T (1, n-2),... T (n-1, 0), set T (i, j) to indicate that the left subtree of the root contains I nodes, and the right subtree contains a J node.
The solution of the set problem is f (n), then f (n) = f (0) *f (n-1) + f (1) *f (n-2) + ... + f (n-2) *f (1) + f (n-1) *f (0). Suppose f (0) = 1, then f (1) = 1, f (2) = 2, f (3) = 5. Combined with recursion, it is not difficult to find that f (n) equals h (n).
4.how many matching methods are there for n brackets?
IDEA: n pairs of parentheses are equivalent to 2n symbols, n left parenthesis, n right parenthesis, can be set to solve the problem of f (2n). The No. 0 symbol is definitely an opening parenthesis, and the closing parenthesis that matches it must be the 2i+1 character. Because if it is the 2i character, then the No. 0 character contains an odd number of characters from the 2i character, and an odd number of characters cannot be matched.
With simple analysis, f (2n) can be converted to the following recursive f (2n) = f (0) *f (2n-2) + f (2) *f (2n-4) + ... + f (2n-4) *f (2) + f (2n-2) *f (0). To explain briefly, F (0) * F (2n-2) means that the No. 0 character matches the 1th character, while the remaining characters are divided into two parts, a portion of 0 characters, the other part is 2n-2 characters, and the two parts are solved. F (2) *f (2n-4) indicates that the No. 0 character matches the 3rd character, while the remaining characters are divided into two parts, 2 characters in part, and 2n-4 characters in the other part. In turn.
Suppose f (0) = 1, calculate the start of several items, F (2) = 1, f (4) = 2, f (6) = 5. Combined with recursion, it is not difficult to find that f (2n) equals h (n).
5, Select 2n points on the circle, the number of points connected together so that the resulting n line segments do not intersect method?
Idea: Take one of the points as the base point, number 0, and then turn the other points in a clockwise direction. Then the number with a number of 0 connected points must be odd, otherwise, the two numbers contain odd points, there is bound to be a point is isolated, that is, on each side of a line segment has an isolated point, resulting in the intersection of two segments. The selected base point is a, and the point to which it is connected is B, so A and B divide all the points into two parts, one on the left side of A and B, and the other on the right side of a and B. Then the two parts can be solved separately.
Set the solution f (n) of the problem, then f (n) = f (0) *f (n-2) + f (2) *f (n-4) + f (4) *f (n-6) + ... f (n-4) *f (2) + f (n-2) *f (0). F (0) *f (n-2) indicates that the point of number 0 is connected to the point of number 1, where the number of points to the right of them is 0, while the point on the left of them is 2n-2. In turn.
F (0) = 1, f (2) = 1, f (4) = 2. Combined with recursion, it is not difficult to find that f (2n) equals h (n).
6. How many ways to divide a convex polygon area into a triangular region?
Idea: Based on one side of a convex polygon, the 2 vertices of this edge are A and B. Choose 1 from the remaining vertices, you can divide the convex polygon into three parts, the middle is a triangle, the left and right sides are two convex polygons, and then solve about two convex polygons.
Set the solution f (n) of the problem, where n represents the number of vertices, then f (n) = f (2) *f (n-1) + f (3) *f (n-2) + ... f (n-2) *f (3) + f (n-1) *f (2). F (2) *f (n-1) indicates that three adjacent vertices form a triangle, and the number of vertices in the other two sections is 2 and n-1 respectively.
Set F (2) = 1, then f (3) = 1, f (4) = 2, f (5) = 5. Combined with recursion, it is not difficult to find F (N) equals h (n-2).
7, Description: There are 2n individuals lined up into the theater. Admission fee is 5 yuan. of which only n individuals have a 5-dollar bill, the other N people only 10 yuan banknotes, the theater no other banknotes, asked how many of the methods so long as there are 10 of people buy tickets, the ticket office has 5 yuan of money change?
Train of thought: can hold 5 yuan to buy a ticket as into the stack, then hold 10 yuan to buy a ticket as 5 yuan out of the stack. This problem translates into the stack order number of stacks. Results are obtained directly from the analysis of application three, andF (2n) equals h (n) *n!*n!.
8. The number of two-fork trees with n+1 leaf nodes is h (n). For example, all two fork tree patterns for 4 leaf nodes:
9, N*n in the grid map, from one corner to another angle, not across the diagonal path number is h (n). For example, the paths in a 4x4 grid map are:
10, Round Table There are 2n individuals, they 22 handshake, but no cross-scheme number is H (n)
11, said 16 people in order to buy sesame seed, of which 8 people each body only a 5 pieces of money, the other 8 people on each body only a 10 yuan. Sesame Cake 5 pieces of a, at the beginning of the pancake shop owner has no money. 16 customers are not ventilated with each other and buy only one. Ask the 16 people how many permutations they have in order to avoid finding a way out of the money. H (8) = 1430, so the total =1430*8! *8!
12, in the library altogether 6 people in the queue, 3 also "The Interview Treasure" a book, 3 in borrows "The Interview Treasure" a book, the library at this time did not have the interview treasure, asks them to queue the total number?
H (3) = 5; So the total is 5*3! *3! =180.
13, for the set of the number of non-intersecting division, here to explain the non-cross division, we for the set {a, b} and {c,d}, assuming they constitute two intervals [A, b] and [c,d], we assume two intervals are not coincident, then the following four cases as non-intersecting: a<c<d <b,a<b<c<d,c<a<b<d and c<d<a<b, which means that two intervals can be included or absent, we call the set {a, b} and {c,d} non-intersecting at this point. For the collection, the element 22 is divided into a subset, a total of n, if any two subsets are not cross, then we call this at this time divided into a non-cross division. At this point does not cross the division number is our, prove also very easy, we will each sub-set the smaller number with the left parenthesis instead, the larger with the right parenthesis instead, then into the original sequence of 1 to 2n formed a legal bracket problem, is our 2nd conclusion. For example, our collection {1,2,3,4,5,6} does not have a cross partition of five: {{1,2},{3,4},{5,6}},{{1,2},{3,6},{4,5}},{{1,4},{2,3},{5,6}},{{1,6},{2,3},{4,5}} and {{1,6},{2,5},{3,4}}.
14, N-layer of the ladder cut to n rectangle of the number of cutting method is also. As shown in the following:
How did this prove? Let's first draw the following picture, which is the ladder of N 5:
We notice that each cut-out rectangle must include a small square labeled *, then we enumerate each * and the # marked two corners as a rectangle, the remaining two small ladder is our two smaller sub-problem, so we notice here is the nature of our previous property 3, So that's what we're asking for.
15. Fill in a 2*n grid with 1 to 2n of these values so that the values in each lattice are smaller than the number of all values on the right and top.
16, the plane connection can form a convex hull 2n points into 2 a group of connected to an N-segment, 22 segments between the total number of disjoint cases,
A variant of the Catalan number problem:
N+m individual queue to buy tickets, and meet, the fare is 50 yuan, of which n individuals each holding a 50 yuan banknotes, m individual hand-held a 100 yuan banknotes, in addition to everyone on the body without any other coins, and initially when the ticket window has no money, ask how many kinds of queuing situation can let everyone buy tickets.
This topic is Catalan number of deformation, do not consider the differences between people, if M=n then is our initial Catalan number problem, that is, the hand-held 50-dollar person as +1, holding 100 yuan of the person as is-1, either before the K number of values and are non-negative sequence number.
The difference lies in the n>m of the situation, at this point we can still use the original proof method to consider, assuming we want the number of cases is, can not get everyone to buy the number of cases is, then there, at this time we beg, we assume the first person can not buy the ticket number is K, he held 100 yuan and the ticket office no money, Then the former K personal money from 50 yuan into 100 yuan, from 100 yuan into 50 yuan, at this time there is n+1 personal hand-held 50 yuan, m-1 a hand-held 100 yuan, so we get, so we get the result, the expression is.
There are many variants of Catalan number, and the combination of mathematics is a very interesting subject, through constant analysis, we can constantly increase the rigor of our thinking and comprehensiveness.
Catalan number and proof of use of Raney lemma