So we see that I've doubled the size of the vector but I've much more than doubled the number of calls.
所以我们看到我,把向量的大小翻倍了,但是我调用的次数,不仅仅是翻倍了。
Well, I'm going to get back, let's just draw a bigger square than usual that's roughly four times the size.
嗯,返回的是,我画一个更大的方形,大致上是4倍的大小。
Obviously the algorithm is likely to depend on the size of the input, so this is not a great idea.
很明显这个算法是与我的,输入的大小相关的,因此这不是个好方法。
suppose I asked you to time a 100 meter spring in the Olympics, but I give you a stopwatch that is measured in units of 15 seconds?
如果我要求你,在奥林匹克数给100米短跑计时,但我会给你一个秒表,它可以测出15秒的大小?
I would be able to predict their size, because how far they moved depended on how big they were.
我还应当能估计它的大小,因为它能跑多远取决于它的大小
I draw a graph here of the amount by which I pull the spring versus the force it exerts.
我在这里画个图,纵轴是弹簧的拉伸量,横轴是力的大小
If we think of the size of a typical atom, we would say that would be about 10 to the negative 10 meters. So, we can see the diameter of a nucleus is absolutely smaller really concentrating that mass into a very small space.
一个普通细胞的大小,抱歉,我和细胞核搞混了0,如果我们考虑,一个普通原子的大小,这大概是10的负十次方米,所以原子核的直径确实非常小,真的是把质量。
The viola is very similar to the violin so anything I sayabout the viola applies to the violin as well, and of course you all are probably familiar with violins and the size.
中提琴和小提琴很相似,所以我讲的一切关于中提琴的原理,同样适用于小提琴,当然,你们可能都比较熟悉小提琴,关于提琴的大小
But now if you have a twenty-ounce bottle, your cue for when the drinking event ends is completely different than when I was a child, and its two and a half times different then when I was child, and so people have become calibrated to what difference sizes are.
但现在如果你喝了一瓶二十盎司可乐,会觉得现在的饮用量,和我小时候已经完全不同了,是我小时候的2.5倍,人们已经校正了其中差异的大小
Ignore this one here 'cause this is when I was just writing down the original list of size 1.
暂且忽略这个,因为它是大小为1的列表中的元素,我只是把它写下来而已。
It implies that this algorithm is calling itself again and again, and again, and on each time the size of the problem I'm trying to sort is being divided by what?
这就说明此算法会一次又一次地调用自己,每次我要排序的问题规模大小,会除以多少呢?
And I don't have to worry about these relative dimensions because we know from Marsden's calculations that, on the length scale that I have shown here, these would be just tiny little dots.
我们不必考虑,它们的相对大小,因为从马斯登的计算中我们可以得知,就从我现在给你们演示的这种相对距离来说,这些电子将只是一些很微小的斑点。
Well, notice again, on each level of the tree, when I actually do the merging, so this remember, is when I wrote down just the numbers when I bottomed out with the list of size 1.
请注意,在这棵树中的每一层,我真正做合并时,就将每个大小为1的列表中的,数字写下来。
So at the moment left hand is at the start of this list of size 1, my right hand is at the start of this list of size 1, and now I need to merge these two lists.
现在左手手指指向这个大小为1的列表的开始,右手手指指向这个大小为1的列表的开始,现在我需要合并这两个列表。
I've seen students photocopy exams down to the size of a postage stamp.
我曾看到过学生将考试内容复印到,一张邮票大小的纸上。
So one of the things I didn't say, it's sort of implicit here, is what is the thing I measuring the size of the problem in?
我有一点没有提及,这有点含蓄,这一点就是我怎么,来度量输入问题的大小呢?,一个数组的大小怎么来定义呢?
So, I'm now multiplying by the result of calling the size of operator, which we've seen before.
现在我乘以运算符的大小,之前我们看到的。
Don't think so, right? So, what does this suggest? Sorry?
对不起我没听清,常量?哦,常量意味着无论数组的大小?
So let's look at the second example, all right, I keep doing that -- this piece of code from here to here gives me a way of now creating a hash table of size 256.
所以让我们来看一下第二个例子,好的,我继续做那件事,这段代码中从这里到这里,是创建一个大小为256的哈希表。
That is the force which I do not know in magnitude.
我并不知道这个力的大小
Now this happens to be what we would call a linear process, because the number of times I go around the loop is directly related to the size of the argument. If I double 2 the argument, I'm going to double the number of times I go around the loop. If I increase it by five, 5 I'm going to increase by five the number of times I go around the loop.
这恰好是我们会成为,线性复杂度程序的一个例子,因为我要执行循环的次数是,和输入的参数的大小直接相关的,如果我将这个参数乘以,那么我就要将进行循环的次数也乘以2了,如果我把参数加上,那么循环的次数也要加上5了。
That's how by either balancing the unknown force with a known force or by simply measuring the acceleration as I fall towards this podium and multiplying by mass, you can find the force that exerts on me.
我们既可以让未知力与已知力平衡,也可以只测量我冲向讲台时加速度的大小,再与我的质量相乘,都能求出作用在我身上的力的大小
As soon as the available size goes to 0, I know I can't enter any more items into the memo, right?
一旦可装大小为0时我就知道,我不能再在memo中添加物品了?
Constant. Ooh, constant says, no matter what the length of the list is, I'm going to take the same amount of time.
这个算法用的时间是相同的,我不这么认为,如果我们创建一个十倍于以前大小的数组。
Let's do a little Copy Paste down here so I can print out its size.
让我再做个复制粘贴,所以我能打印它的大小。
As I said, what we want to do is, we want to count the number of basic steps it takes to compute a computation as a function of input size.
我刚才提到了,我们要建立,一个根据输入大小的方法来计算,一个计算过程需要的时间,建立这个方法需要几步呢?
I like the angstrom because atomic dimensions are conveniently measured by angstroms.
我喜,埃,因为原子大小的东西,用埃来度量更方便。
So let me go ahead and pull up the staff solution 15 to the standard edition for a moment, the game is called 15, it takes one command line argument which is the dimensions of the board 3 by 3, 4 by 4, I'll do it 4 by 4.
下面我们继续,等一会儿,我会给出标准的解答,这个游戏叫做,有一个命令行参数,标识其大小是,3阶还是4阶,我选择4阶。
We don't seem to be doing that just yet, certainly not as badly, alright, so at this point in the story I have a sorted list of size 4.
当然现在我们不需要那样做,此时此刻,我已对整个问题中大小为4的列表排好序了。
So, should I be drawing these boxes four times bigger since ints are four times bigger than chars usually?
所以,我应该把这个盒子画成4倍大,因为一般int型是char型的4倍大小?
应用推荐