Skip to content

Commit 669fa76

Browse files
committed
Update 01.Recursive-Algorithm.md
1 parent 0cea483 commit 669fa76

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Contents/09.Algorithm-Base/02.Recursive-Algorithm/01.Recursive-Algorithm.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ fact(6)
5454

5555
这两个部分也可以叫做「递推过程」和「回归过程」,如下面两幅图所示:
5656

57-
![](https://qcdn.itcharge.cn/images/20220407160648.png)
57+
![递推过程](https://qcdn.itcharge.cn/images/20220407160648.png)
5858

59-
![](https://qcdn.itcharge.cn/images/20220407160659.png)
59+
![回归过程](https://qcdn.itcharge.cn/images/20220407160659.png)
6060

6161
如上面所说,我们可以把「递归」分为两个部分:「递推过程」和「回归过程」。
6262

@@ -175,7 +175,7 @@ $f(n) = \begin{cases} 0 & n = 0 \cr 1 & n = 1 \cr f(n - 2) + f(n - 1) & n > 1 \e
175175

176176
其对应的递归过程如下图所示:
177177

178-
![](https://qcdn.itcharge.cn/images/20230307164107.png)
178+
![斐波那契数列的递归过程](https://qcdn.itcharge.cn/images/20230307164107.png)
179179

180180
从图中可以看出:想要计算 $f(5)$,需要先计算 $f(3)$ 和 $f(4)$,而在计算 $f(4)$ 时还需要计算 $f(3)$,这样 $f(3)$ 就进行了多次计算。同理 $f(0)$、$f(1)$、$f(2)$ 都进行了多次计算,就导致了重复计算问题。
181181

0 commit comments

Comments
 (0)