STUDENT: Right, we're going to do that in a second, but the answer is Fibonacci numbers, we define the first two.
学生:听不见:,我们马上会试一试,但是答案是斐波那契数列,我们可以定义下最初的两个数。
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.
斐波纳契,它是波纳契的儿子,波纳契是它父亲的名字,听上去是个友好的男人不是吗,谁知道斐波纳契数列?
What he did was coined this. But he found that by taking the reciprocal of the wavelengths, you have four numbers, he took the reciprocals of those wavelengths and found that they fit a numerical sequence.
这些都是由他所做的一切得来的,但是他发现通过取波长的倒数,你有四个数字,他取了这些波长的倒数,发现它们构成了一个数列。
But all of you in this room probably remember what we technically call the base 10 system or decimal system because back in grade school or the like, you learned to count and add and subtract numbers by way of columns.
但是,在座的每一位可能都记得,这在小学的时候学的,以10为进制的系统或者十进制系统,通过数列方式学习数数和加减法。
That's an infinite series and you know how to sum that, I think.
这是个无穷数列,你们应该知道怎么计算
And the reason I want to show you this is to notice that the recursion can be doubled.
如果我来写斐波那契数列你可以看看这儿,原因是我想让你看看这部分的递归可以翻倍。
On Tuesday we'll talk about a different way to implement Fibonacci, where the growth will be much less dramatic. Thank you.
周二我们将会讲一种,不同的Fibonacci数列解决方案,这个方案的增长会小得多,谢谢。
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.
要指出的是我们已经,调用了几次这个全局变量,这不是因为斐波那契数列,需要调用它而只是,因为教学上的需要,以便我们可以知道,这个函数做了多少事情。
Nobody in their right mind actually implements a recursive Fibonacci the way I did it originally.
没有谁真的在右脑中,按我最初讲的递归方法,计算Fibonacci数列。
And so we've got it up here, a nice little recursive implementation of it.
然后在这里有个这样的数列,一个很好的用递归来实现的斐波那契i数列。
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数列一样,他不断地重复相同的工作。
应用推荐