I'm going to come back to that in a second with that, but I need to do one more example, and I've got to use my high-tech really expensive props. Right. So here's the fourth or fifth whatever we're up to, I guess fifth example.
并且我会用到我的,高科技的昂贵小道具,好,这是第四个还是第五个了?,好,我猜是第五个例子了,这是个被称为汉诺塔的问题。
It's like these little parks in New York all are small enough to be good for little meetings.
就好像纽约的这些小公园,对小聚会来说,规模刚刚好。
And again, very much in the same style of the quizzes All right, let's look at this.
但是还是和小测验的形式差不多,好了,我们来看到程序。
I have sorted with the smaller problem 1 because that smaller problem right now is of size 1 and so it's sort of obviously the case that this cup is now sorted.
对这个较小的问题我已经排好序了,因为在这个小问题中只有1个元素1,那么很明显,这个杯子已经是有序的了。
Jean in Bordeaux, to the train station, to be shipped off to the east; but, he did very well, he became a minor Gaullist official, and he did very well, and they finally caught up with him.
到了车站,然后再被海运到东方,但是他干得很好,他成了一个戴高乐派的小官,他干的也很好,最后他们终于逮着他了
It was great movie. It's, it's really cute when that came out when I was younger, so.
那是部好电影。我小点的时候看觉得好可爱。是的。
which is crazy because it's a little basement flat, but because of where it is.
这非常疯狂,因为它只是一个小的地下室公寓,只是它的地理位置好而已。
Can you give us some tips for taking nice pictures?
能给我们一些拍摄好照片的小窍门吗?
Because if b was odd, then b minus one is even which means on the next step, I can cut the problem in half again.
这意味着我在下一步里解决的问题,规模要小了一半,好,课堂材料的第三题。
This is a little file I created, all right, and I'm going to start with a sequence of these things and walk them along, again I invite you to put comments on that handout so that you can follow what we're going to do. All right?
这是我创建的一个小文件,好,然后我回去以一系列这样的事情,开始然后进行下去,我还是想大家都在手册上做一些注释,这样我们就能对将要做的事情,做一个记录了,对不对?
Good question, so there is this little reading head kind of like in an old phonograph player that does move back and forth and in and out depending on the implementation.
好问题,这就像,老留声机里的小读头,它通过来回移动,来完成不同的操作。
If I look for, say, minus 1, you might go, gee, wait a minute, if I was just doing linear search, I would've known right away that minus one wasn't in this list, because it's sorted and it's smaller than the first elements.
如果我要查找-1,你可能要怒了,呵呵,等一等,如果我用的是线性查找,我不会知道-1不在这个列表中,但是列表是排好序的,1又比第一个元素小。
All right. Let's do a couple of other simple examples. All right?
好,让我们再来看看,其他的小例子好不好?
OK, once it gets to the end of that, what's it going to do? It's going to come down here and, oh. What's that doing? Well I cheated when I started. I said, somebody's giving me a perfect square, I'm looking for the square root of it. But suppose 15 I gave this thing 15, and asked it to run.
好,一旦到了循环的最后,程序会去做什么?程序会跳到这里来,噢,这是干什么的?好吧,当我开始的时候我有点小作弊的意思,我说过,我得到了一个完美的平方数,我要求这个数的平方根,但是假设下我得到的数是。
Well, I'm going to create a little infinite loop.
好,我会建立一个小的无穷循环。
应用推荐