1. Summary of Common Series
(1) Fibonacci sequence:
How to implement the Fibonacci sequence, we can take the following methods:
(1) Recursive solution (slow) (2) Recursive method (3) matrix fast Power
The following gives the origin of the Matrix fast power:
In addition to these problems, we may also involve the processing of high-precision numbers in the Retracement series.
(2) Number of Cattleya
Catalain number is a series of combinatorial mathematics that often appear in various counting problems. By the Belgian mathematician Eugen Charlie Katalan (1814–1894) named.
The general formula for Catalain number is alternative recursion: h (n) = ((4*n-2)/(n+1)) *h (n-1);
The first few items are (Oeis in the sequence A000108): 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670 , 129644790, 477638700, 1767263190, 6564120420, 24466267020, 91482563640, 343059613650, 1289904147324, 4861946401452, ...
Properties
C Another form of expression for n is therefore,Cn is a natural number; This is not obvious in the previous general formula. This form of expression is also the basis of André 's proof of the previous formula. (See the second proof below.) )
Catalain number satisfies the following recurrence relationship
It also satisfies
This provides a faster way to calculate the number of Catalain.
The asymptotic growth of Catalain number is
It means that the quotient of the left-hand divided by the right-side tends to be 1 when n →∞. (This can be proved by the Stirling formula of N!). )
All the odd catalain number Cn satisfies n = 2k − 1. All the other Catalain numbers are even.
Application
There are a lot of combinatorial mathematics. The combined structure can be counted by the number of Catalain. In the exercises of Richard P. Stanley's enumerative Combinatorics:volume 21, there are 66 different combinations that can be expressed by catalain numbers. The following are examples of C-N= 3 and c-N= 4:
- C N indicates the number of Dyck word with a length of 2n . Dyck Word is a string of n x and n y, and all partial strings satisfy the number of x greater than or equal to Y. The following is a Dyck words with a length of 6:
xxxyyy xyxxyy xyxyxy Xxyyxy xxyxyy
- Replace the x in the previous example with an opening parenthesis, y with a closing parenthesis, andCn for all the number of legal expressions that contain the n set of parentheses:
((())) ()(()) ()()() (())() (()())
- C N indicates the number of two-fork trees with n+1 leaves.
- C n is the number of all two-forked trees with n branching nodes that are different in their structure. (a binary tree with a root is full when and only if each node has two subtrees or no subtree.) )
Prove:
1 means the stack, 0 represents the stack, it can be converted to a 2n bit, containing n 1,n 0 of the binary number, to meet from left to right scan to any one, after the 0 number of not more than 1. It is obvious that there are a total of 2n binary numbers with n 1,n 0, and the number that does not meet the requirements is considered below.
Consider a 2n bit binary number with n 1,n 0, scanned to the 2m+1 bit when there are m+1 0 and m 1 (it is easy to prove that there must be a case), Then there must be a n-m of 1 and n-m-1 0 in the following 0-1 permutations. Convert 2m+2 and its subsequent parts 0 to 1 and 1 to 0, corresponding to a binary number of n+1 0 and n-1 1. and vice versa (similar thinking proves that both one by one correspond).
Thus. The certificate is completed.
- C n represents the number of all monotone paths that do not cross the diagonal in n x n grid points. A monotone path starts at the lower-left corner of the lattice point and ends in the upper-right corner of the lattice point, with each step up or to the right. Calculating the number of such paths is equivalent to calculating the number of Dyck Word: X for "right" and Y for "up". For the case of n = 4:
- C n is the number of methods that divide the convex polygons of the n + 2 edges into triangles by linking vertices. In the case of n = 4:
- C N indicates the number of permutations in and out of the stack for {1, ..., n}. A permutation W is sequentially in and out of the stack when s(w) = (1, ..., n), where s(w) recursion is defined as follows: Make w = UNV, where n is the largest element of W , and you and v are shorter sequences; again S(w) = S (u) S (v) n, where S is the unit element for all the series with one element.
- C n represents the number of non-intersecting partitions for the collection {1, ..., n}. Then, Cn is never greater than the nth Bell number. C N also represents the number of non-intersecting divisions of the collection {1, ..., 2n}, where each paragraph has a length of 2. Combined with these two conclusions, it is possible to use the mathematical induction to prove that any of the free cumulants of degree and than 2 of the Wigner semicircle law is zero. This are important in free probability theory and the theory of random matrices.
- C n indicates the number of methods to fill a ladder -like shape with n rectangles with a height of n. For the case of n = 4:
Algorithmic competition Getting Started classic training Guide "recursion problem"------January 24, 2015