Current location - Training Enrollment Network - Mathematics courses - In the data structure, n pieces of data are put on the stack in turn. How many kinds of transfer-out orders are there? Who can help prove it?
In the data structure, n pieces of data are put on the stack in turn. How many kinds of transfer-out orders are there? Who can help prove it?
N pieces of data are put into the stack in turn, and the recursive formula of the number of categories in the stack-out order is as follows:

F(n)=∑(F(n- 1-k)* Fk); Where k is from 0 to n- 1.

It is known that F0= 1,

F 1=F0*F0= 1

F2=F 1*F0+F0*F 1=2

F3 = F2 * F0+f 1 * f 1+F0 * F2 = 5

……

It is proved that for n data, I only look at the order of the first data entering and leaving the stack:

The first data can contain 0, 1, 2…n- 1 data in and out of the stack.

Accordingly, after the first data is popped up, there are still n- 1, n-2...2, 1, 0 data to be popped up and put on the stack.

According to the multiplication principle in combinatorial mathematics, it is necessary to multiply the species before and after the first data is out of the stack.

According to addition principle, it is necessary to add all n paths of the first data in and out of the stack.

So we get the recursive formula, but it seems difficult to find a formula to calculate Fn directly.