And because, as long as this collection is finite, this thing is just going to walk through. All right?
这个操作就会遍历完它的,对不对?,那么,如果我给大家看看,例如?
So the first thing we'll do is, we'll print the element, in this case it will be a list right? Because it's a list with two lists in it.
因此这儿我们要做的第一件事,就是要显示元素,在这儿元素就是数组了对不对?,因为这个数组包含了两个数组。
And the claim that psychoanalysis proves itself by being- by its tremendous success in curing mental illness is also almost certainly not true.
对于精神分析,通过在治疗心理疾病方面获得的巨大成功,证明了其理论的正确性,这个观点当然也是不对的。
If you, at the end of the semester, haven't agreed with me about this particular claim or that particular claim, so be it.
如果你在这个学期末,还是不对我这个特别的观点持赞同意见,那么顺其自然吧。
On the other hand, if the value I'm looking for here- sorry, the value I'm looking for is smaller than the value I see here, I just need to look here. All right?
如果我的目标数比这个值要小呢?,我就在这边找就对了,对不对?,做完了这一步,我可以在下一步做相同的操作,假设我选中了这一分支?
Then if I'm looking for the square root of something less than 1, I know it will be in my region, right?
如果我要求平方根的数小于,我就知道我们的答案应该,在0-1这个区间了,对不对?
So halfway is the right thing to do, because at each step, I'm guaranteed to throw away at least half the list. Right? And that's nice.
一半以上的元素,对不对?,这很棒,好,大家猜猜这个算法的增长率是多少?,为什么?太对了。
So let's look at a little example, and this is going to, excuse me, both allow us introduce the syntax as well as what we want to have as the flow of control inside of here.
让我们看个小例子,这个程序会,对不对,请允许我,一边顺着控制流进行,一边讲解语法。
Now. You might look at that and say, well that's just a lot like what we had over here Right? We had some additive constant plus a simpler version of the same problem reduced in size by 1.
现在你可能会看着这个说,这很像我们以前做过的,对不对?我们用一些附加的常量,加上问题的另外一个规模缩小了1的,简化版本来代替这个问题本身。
Ah, n times, because for each value of i, I'm going to do that m thing, n*m so that is, close to what you said, right?
因此这就和你说的差不多了对不对?,这个问题的复杂度为,让我写下来,是-对不对,是?
So the basic idea was fine, but I failed to satisfy the initial condition that the answer had to be between the lower bound and the upper bound. Right?
因此基础的思想是对的,但是程序没能满足,正确答案在给定的区间内这个条件,对不对?
Show me a place where that's not true where the tangent line will be really bad.
请给我个这个原则不对的例子,也就是说切线没起到相应作用的例子。
It can't be true because there's two ways in which the brain is better than a computer.
这个观点之所以不对,是因为大脑在两个方面上,要优于计算机
The last thing I want to point out to you is, I started out with this list. I haven't added anything to the list, right? I mean I've got a different kind of looping mechanism.
我们从这个列表开始,我没往这个列表上加任何东西对不对?,我的意思是我学会了一种不同种类的,循环机制,我想我得说。
And the problem is, that we want to build this abstract data type, but we'd like to basically know what kind of object is it, and what functions actually belong to it, how do we use them?
然后我对它们运行了这个方法,就是这一小段代码这个方法,这有意义么?,当然没有了,对不对?,因为你知道,当你把两个极坐标,表示的点进行相加运算的时候?
All right? I mean, I can make money at Harvard Square doing this stuff, right?
对不对?【鼓掌】我意思是,我可以在哈佛广场,靠做这个赚钱对不对?
All right? What's the value of that expression?
对不对?这个表达式的值是多少?
So I just computed the radius of that particular thing. Right?
这个点的半径,对不对?,计算角度是一样的道理?
The trouble is harmony shows that that's not so.
问题是和声这个例子说明这种不对。
Sorry? OK. You're doing the whole thing for me What's the complexity just of this inner loop m How many times do I go through that loop?
就这一块代码的,我执行了多少次这个循环?,次对不对?,here?,Just,this,piece。,我一会儿就会去得到你的答案的?
bug If you find a bug, it probably means there bug are more of them. So you ought to be bug a little bit careful. The story I've heard told is you're at somebody's house for dinner, and you're sitting at the dining room table, then you hear a .
对不对?你得修复这个,如果你发现了一个,可能就意味着还有更多的,因此你应该小心点,我听说的一个故事,是当你在别人家吃饭的时候,你坐在餐桌上呢,然后听到了邦的一声响。
Meaning, why in the world do I have to tell the reader that I'm binding x to the value three? All right?
意思就是,我为什么要,告诉代码阅读者,要把x绑定到3这个值上呢?,对不对?
The check needs to be somewhere in the program, but this is not the right place for it.
这个check必须出现在程序中,但是放在这儿是不对的。
People can get hung up on sort of hunting these things down, and stamping them out, one at a time. And it's a little bit like playing Whack-a-Mole. Right?
我们可能会一次一个的去发现,这个bug并且消灭它,这有点像打鼹鼠对不对?,不停的有鼹鼠跳起来?
b OK. In this example I'd use b. All right, as b get-- b is the thing that's changing as I go along here, but it could be things like, how many elements are there in a list if the input is a list, could be how many digits are there in a string if the input's a string, it could be the size of the integer as we go along. All right.?
好,在这个例子里我会用,因为b是一直在变的东西,但是也可能是如下情况:,如果输入是数组的话,变化的就是数组的元素数,如果输入是字符串的话,变化的就是字符串的长度,如果是integer的话,可能就是这个数的大小,对不对?
So I guess I should go back, and let me do this correctly this way. Again, I can look at test, test and I guess test now if I want to get the element out-- angle bracket or square bracket?
但是这不是我想要的对不对?,我认为我该回到这里,让我改正这个错误,好,那么我还是对元组,那么现在我想从test中取出元素来?
应用推荐