Number of Catalan--Cattleya number

Source: Internet
Author: User

I. Definition of Catalan number

Make h (0) =1,h (1) =1,catalan number satisfy recursion:h (n) = h (0) *h (n-1) + H (1) *h (n-2) + ... + h (n-1) *h (0) (n>=2)

The solution of the recurrence relationship is:h (n) = C (2n,n)/(n+1), n=0,1,2,3,... (where C (2n,n) represents the number of n in a 2n item)

Ii. Description of the problem
12 tall and different people, lined up in two rows, each row must be from short to high, and the second parallelism corresponds to the first row of people high, ask how many kinds of arrangement?

Problem Analysis:
We first put these 12 people from low to high, and then, select 6 people in the first row, then the remaining 6 must be in the second row.
Use 0 to indicate the corresponding person in the first row, with 1 to indicate the corresponding person in the second row, then contains 6 0, 6 1 sequence, corresponding to a scheme.
For example, 000000111111 corresponds to the
First row: 0 1 2 3 4 5
Second row: 6 7 8 9 10 11
010101010101 corresponds to the
First row: 0 2 4 6 8 10
Second row: 1 3 5 7 9 11
The problem is converted to the number of 01 sequences that satisfy the condition.

Observe the law we found that 1 of the appearance must have a corresponding 0 corresponding, so from left to right all the sequence of 0 is always greater than the number of 1. How many kinds of permutations are there in this series?

Then we scan from left to right, the first occurrence of the number of 1 is equal to the number of 0 is the K-bit, then before this, the number of 0 is greater than the number of 1. After this, the number of 0 is also greater than 1 of the number. So the number of K-bits 0 and 1 is the first equal arrangement with the result of the number of these two parts. So the number of all k, then add them up, is the final permutation. This is a recursive problem.

i.e. h (n) =h (0) xh (n-1) +h (1) *h (n-2) +...+h (n-1) *h (0)

If you think of 0 as a stack operation, 1 as a stack operation, that is, given 6 elements, the number of valid stack-stack sequence.

In << computer programming art >>, the third edition, Donald E.knuth, Su Yunlin, Volume One, page 508, gives proof:
The main problem is to use s for the stack, x represents the stack, then the number of valid sequence (s number is n)
There are obviously C (2n, n) sequences with n s,x each, and the rest is to calculate the number of sequences that are not allowed (it contains the correct number of s and X, but violates other conditions).
In any disallowed sequence, set the position of the first x that causes the number of x to exceed the number of S. Then in the sequence of parts that cause and include this x, take s instead of all x and X for all S. The result is a sequence that has (n+1) a s and (n-1) x. In turn, for each sequence of one type of scale, we can reverse the process and find out the disallowed sequence of the previous type that caused it. For example Xxsxsssxxsss must come from ssxsxxxxxsss. This correspondence indicates that the number of disallowed sequences is C (2n, n-1), so h (n) = c (2n, N)-C (2n, n-1).

Three, recursive formula

Alternative recursion Type:
   h (N) =h (n-1) * (4*n-2)/(n+1)The solution of a recursive relationship is:h (N) =c (2n,n)/(n+1)(n=0,1,2,...) The alternative solution to the recursive relationship is:h (N) =c (2n,n)-C (2n,n-1)(n=0,1,2,...) The first items are: 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670, 129644790, 477 638700, 1767263190, 6564120420, 24466267020, 91482563640, 343059613650, 1289904147324, 4861946401452, ...Iv. Related Issues

1, given the number of n, how many kinds of stack sequence?

(image description of the problem:

After dinner, the elder sister washes the dishes, the sister washes the elder sister's bowl one by one into the cupboard stacks into a pile. There are a total of n different bowls, before washing is stacked into a pile, perhaps because the little sister to play and make the bowl into the cupboard, the elder sister will wash the bowls in the side, asked: how many kinds of bowls of the little sister can be the way?

A string of n 1 and n -1, and the sum of the first k is not less than 0, then what is the total number of such a string?

P=a1a2a3 ... An, according to the multiplication of the law, do not change its order, only in parentheses to denote the product of the pair, how many kinds of parentheses? )
2. How many configurations are there for the two-fork tree of n nodes?

3. What is the number of full two-fork trees with n+1 leaves?

4, in the N*n lattice, only in the lower triangle walk, each time horizontal or vertical walk a lattice, how many in the way?


5. How many ways to divide a convex n+2 into a triangular region?


6, select 2n points on the circle, the number of points connected together so that the resulting n line segments do not intersect method?

7.N rectangles fill a ladder-shaped graph with a height of n .

Some of the above problems are isomorphic, but some do not see the connection, their answer is Cattleya number.

Number of Catalan--Cattleya number

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.