STUDENT: Right, we're going to do that in a second, but the answer is Fibonacci numbers, we define the first two.
学生:听不见:,我们马上会试一试,但是答案是斐波那契数列,我们可以定义下最初的两个数。
And the reason I want to show you this is to notice that the recursion can be doubled.
如果我来写斐波那契数列你可以看看这儿,原因是我想让你看看这部分的递归可以翻倍。
It takes the number whose Fibonacci memo I want plus a memo.
它将我想要的斐波那契数,的值加上了参数。
You remember last time we were looking at Fibonacci.
你还记得上次我们在研究斐波那契数列吧。
And the thing I wanted point out is, we've got this global variable number of calls. Which is there not because Fibonacci needs it but just for pedagogical reasons, so that we can keep track of how much work this thing is doing.
要指出的是我们已经,调用了几次这个全局变量,这不是因为斐波那契数列,需要调用它而只是,因为教学上的需要,以便我们可以知道,这个函数做了多少事情。
And so we've got it up here, a nice little recursive implementation of it.
然后在这里有个这样的数列,一个很好的用递归来实现的斐波那契i数列。
应用推荐