And the third thing I need to decide is how do I combine? You know, point out to you in the binary search case, combination was trivial. The answer to the final search was just the answer all the way up.
第三个问题是我需要决定如何进行合并?,就你们所知的,在二分查找中所打印出来的,合并的过程是非常简单的,最后查询的结果,就是一路上来所以的结果。
But if you say, well, I don't know how to do this, I am not going to bother, don't grade the paper.
但是如果你说,好吧,我不知道怎么做这个,我想麻烦,别给试卷评分。
And yeah, I know you know how to do it, but let's think about what might happen if I wanted to do that.
对,我知道你们知道该怎么做,那么让我们看看如果我,想要完成的话会发生什么。
I'd be interested to know, gentleman down here, how do you do this?
我很好奇,我想知道,下面这位男士,你是怎么听的
I think what makes a difference is not only do you, yourselves, know better how to play this game now, but you also know that everybody around you knows better how to play the game.
我觉得因为不仅你们自己,玩这个数字游戏玩得更好了,你们也了解到周围的人,也玩得更高了
What I was going to say is that you could, at least theoretically, strike with your spear in a overhand manner or you could strike with it in an underhand manner, the only thing is I don't know how you do that underhand when you're in the middle of a phalanx.
我要说的是,士兵们能够,至少从理论上来说,可以自上而下地刺矛,也可以这样自下而上地刺矛,我不太清楚在方阵中,士兵们怎么能够自下而上地刺矛
If unfamiliar, these are the mechanical computer devices that you have to use to buy a ticket on the T these days and there was one of these really awkward but touching situations where it was clear that this woman had no idea, you know, what to do, how to get from here to here, and I could see her just staring at the turnstiles that you're supposed to go through to get into the subway.
如果不熟悉,这是机械计算机设备,当今你必须使用它们来买地铁票,它们实在是难操作的,这个令人同情的情况是,明显这位老太太不知道怎样操作,怎样从这一步到那一步,我看见她只是凝视着,地铁的栅门口。
Well let's see. My fall back is, I could just do linear search, walk down the list one at a time, just comparing those things. OK. So that's sort of my base. But what if I wanted, you know, how do I want to get to that sorted list? All right?
我只能做线性搜索了,一次遍历一遍列表,一个一个比较,但如果我想要,那怎样得到有序的列表呢?,现在的一个问题是,我们排序之前?
How do you know that your parents, at least one of your parents satisfies the definition? Well I've reduced the problem from am I a natural born US citizen to is one of my parents a natural born US citizen?
这是一个递归的定义,你怎么知道你的父母,至少其中一个是满足天生的美国公民,这个定义的呢?,我已经把我是一个天生的美国公民这个问题?
So you can actually say, how do I know which methods are associated with the class? For that, we can call dir. And what it does, is it gives me back a listing of all the things, dir all the methods, that are associated with it.
我们开始建立类了,我们得到了这些方法,因此实际上你可以说,我怎么知道,哪些方法是关联与这些类的?,为了解决这个问题,我们可以调用,这个方法的作用。
But notice what this does. The first thing it does is, it says, let's check and make sure x is greater than or equal to 0. If it isn't, notice what's going to happen. None of that block is going to get executed, and it's going to come down here and print out a useful piece of information, which says, hey, you gave me a negative number. I don't know how to do this.
做的是和以前一样的事情,但是注释它做了什么,第一件做的事情就是,程序说,要去检查并且确信x是大于等于0的,如果不是的话,请注意会发生什么,下面的代码都不会被执行,程序会到这里来然后显示一些有用的信息,信息会说,嘿,你给了我一个负数,我不知道该怎么弄这个了。
应用推荐