recursive model

Re-read the recursive courseware, some newly understood models:

Tower of Hanoi

f[i] is i disks, and the minimum number of steps to transfer to another with the help of the third column
must through these three steps:
1. First move 2..i from a->b, with the help of c, f[i- 1] Step
2. Then move 1 from a->c, 1 step
3. Move 2..i from b->c, with a, f[i-1] step

f[i]=2[i1]+1 which is f[i]=2i1

Misalignment

There are n people with n books, and each person's book must be different from the original. Find the number of solutions:
let f[i] represent the answer of n=i.
1. If the nth person and the xth person (1<=x<n) If individuals exchange books, the number of options is f[n-2]
2. If the book taken by the nth person is x, but x does not take n’s book, then n’s book cannot be placed in x’s hand (otherwise it is case 1 ), then it is equivalent to n-1 people and n-1 books, the answer is f[n-1]
and there are n-1 selection methods for x, so f[i]=(f[i1]+f[i2])(i1)

Cattelan number

http://blog.csdn.net/jokerwyt/article/details/77414853
Convex Polygon Subdivision:
Let f[i] be the answer of the i-gon.
Choose sides 1, 2, and then choose any one of 3..n to form a triangle.
Then the left and right sides are two polygons that need to be further subdivided. The recurrence formula is the second formula of Cattelan number.

Integer factorization problem

把正整数N分解成M个正整数的和,M个加数相同但顺序不同认为是相同的方案,要求总方案数。如3=1+2跟3=2+1是两个相同的方案。:
Create a new number each time, or add one to all the previous numbers.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325444516&siteId=291194637