遞迴


1.Fibonacci

2.Binomial Coefficient
—>C n取m = C n-1取m + C n-1取m-1

3.GCD(A, B)
=B, if A mod B = 0
=GCD(B, A mod B), otherwise

4.Ackerman’s functionA(m, n)

= n+1, if m = 0
= A(m-1, 1), if n = 0
=A(m-1, A(m, n-1)), otherwise

5.Towers of HanoiHanoi(n, A, B, C)

6.n個字元做Permutations
1.令list[1, ..., n]
2.輪流每 個值皆和list[1]換,然後其餘list[2, ..., n]做permutation遞迴

results matching ""

    No results matching ""