We started off talking about binary search, and I suggested that this was a log algorithm which it is, which is really kind of nice.
我告诉了你们这是一个对,数级的算法,这是很棒的,我们来一起看看这个算法到底做了什么。
and you can get loads of different lunches, wraps, sandwiches and all that, which is really nice.
你可以吃不同的午餐、面卷、三明治,所有的这些,真的很棒。
And the nice thing is that there's a shared behavior there. Just as I can have tuples as an ordered collection of things, strings behave as an ordered collection of things.
共享的行为,就像元组是有序的元素序列,字符串也是有序的元素序列,因此我可以对字符串做同样的操作,我可以把它们连结起来。
What we're proposing here is that you take a nice low energy s electron and move it into a higher energy p orbital.
我们这里说的是,你把一个低能s电子,移到高能p轨道里去。
Yeah, like, I've experienced in nursing program that everyone is like so nice and supportive like...
我在护理专业接触的人都很友好,大家互相支持,比如……
and the campus is so nice and the weather is beautiful, so it wasn't that bad.
校园很漂亮,天气也很好,所以都挺不错的。
LA is well known for its nice, warm weather. What about days that aren't nice?
洛杉矶以宜人、温暖的天气著称。那些不那么好的天气呢?
OK, so what have I done? I just added a little bit more now. I'm now running through a pair of loops. Again notice the encapsulation, that nice abstraction going on, which is what I want. Once I get to this stage though by the way, there might be more than one solution.
我现在运行了一对循环,再一次注意这个封装,抽象得很好,这就是我想要的结果,我按这种方式走到这一步的时候,可能会有多组答案。
And that's very nice, because this allows me to be sure that my FOR loop is going to terminate.
因为这让我确信我的FOR循环是会终止的,因为只要集合是有限的。
This is nice shorthand, all right, but it's something that in fact I probably would want to do differently.
但是实际上有一些东西,我可能想换种不同的方式来做,为什么我要换种。
And I'm hoping that today's lecture will help you learn faster. The nice thing, is once you learn to debug programs, you will discover it's a transferable skill.
但是突然成果就会显现出来,你们现在正在慢慢学着呢,我希望今天的课程能帮助你们学的快一点,好的一方面是,一旦你学会了如何调试程序。
And I haven't said yet, how do I get that collection, but you could certainly conceptualize that, if I had that collection, that would be nice thing to do. That is a more common pattern.
也可以这么来操作,这是个更常用的模式,这基本上也就意味着,对于某些数据的集合,我想要一个循环机制。
It would be nice if it was less than linear, but linear is nice because then I'm going to get that n log in kind of behavior.
那么就是一个不错的算法,但是线性方案也是很好的,因为我需要做n次的log级的行为。
Why is this much nice? Well, that's a handy piece of code. Because imagine I've got that now, and I can now store that away in some file name, input dot p y, and import into every one of my procedure functions, pardon me, my files of procedures, because it's a standard way of now giving me the input.
为什么这样很好呢?,这是一段很好用的代码,因为想象下如果我有了这段代码,我能把它用某个文件名保存起来,后缀是。py,导入到所有的处理函数中,抱歉,我的处理文件,因为这是一个标准的输入方法。
应用推荐