STUDENT: Right, we're going to do that in a second, but the answer is Fibonacci numbers, we define the first two.
学生:听不见:,我们马上会试一试,但是答案是斐波那契数列,我们可以定义下最初的两个数。
Does anyone know the history of what Fibonacci was trying to do? Sorry, let me re-ask that. Fibonacci.
创始人是斐波纳契,有人知道斐波纳契想要干什么吗?抱歉,让我再问一次。
I should add that in some sense this is a phony Fibonacci straw-man Fibonacci.
我应该补充一点,那就是从某种意义上来说,这是一个不真实的,名义上的。
Which actually is son of Bonacci which is the name of his father who was apparently a very friendly guy. First of all, does anyone know what a Fibonacci number is? Wow.
斐波纳契,它是波纳契的儿子,波纳契是它父亲的名字,听上去是个友好的男人不是吗,谁知道斐波纳契数列?
On Tuesday we'll talk about a different way to implement Fibonacci, where the growth will be much less dramatic. Thank you.
周二我们将会讲一种,不同的Fibonacci数列解决方案,这个方案的增长会小得多,谢谢。
It takes the number whose Fibonacci memo I want plus a memo.
它将我想要的斐波那契数,的值加上了参数。
If I write Fibonacci, you see it right there.
也就是前两个月的总和。
And then the next Fibonacci number is the sum of the previous two.
数值为,然后下一个数。
You remember last time we were looking at Fibonacci.
你还记得上次我们在研究斐波那契数列吧。
All right, I want to show you one last example of using recursion because we're going to come back to this. This is a classic example of using recursion. And that is dating from the 1200s and it is due to Fibonacci.
并且返回答案,我想给你看看递归的最后一个例子,因为我们还要再看一遍,这是一个递归的经典案例,它可以追溯到13世纪。
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.
要指出的是我们已经,调用了几次这个全局变量,这不是因为斐波那契数列,需要调用它而只是,因为教学上的需要,以便我们可以知道,这个函数做了多少事情。
I'll get rid of Fibonacci here, we don't want to bother looking at that again.
我在这里会注释掉Fibonacci数,我们不想再看一遍。
Nobody in their right mind actually implements a recursive Fibonacci the way I did it originally.
没有谁真的在右脑中,按我最初讲的递归方法,计算Fibonacci数列。
Because when somebody calls Fibonacci, memo they shouldn't worry about memos.
因为当调用Fibonacci数列时,人们往往不会在意这些。
Just like Fibonacci, it's doing the same work over and over again.
就像Fibonacci数列一样,他不断地重复相同的工作。
应用推荐