OK, in fact if we look at this, if I say, print of p, it prints it out in that form.
好,实际上如果,我们来看看这个,如果我输入,p的显示。
And yeah, I know it comes built in, that's OK, what we want to do is use it as an example to look at it.
对,我知道这个方法可以通过内置的算法,来实现,这没关系,我们只是,把它当做一个例子来讲解。
OK? And in fact, if you look at the code up here, and it's on your handout, the very first one, x 1, right here- if I could ask you to look at it-- is a piece of code to do it. And I'm less interested in the code than how we're going to analyze it, but let's look at it for a second.
实际上,如果你看看,你们课堂发的材料上面的代码,第一页上的,就是那-,大家请看看实现的这一部分代码,我不太关心,我们会怎么解释这个代码,首先让我们先看看。
And let's take a look at it. OK?
在我们看代码之前?
OK, so let's look at it.
好了,让我们来看一下这个程序。
OK, and if I wanted to look at it, we can come back over here, and we can see what does c p 1 look like, interesting.
现在对于这里的每个实例,我都赋了x和y值,好,那么如果我想要研究下它,我们可以回到这里来。
OK? You can take a quick look at it, a even with the wrong glasses on, it says if a 1 sorry, b is equal to 1, a I'm just going to return a.
你们可以快速的过一遍,它是这么写的:如果,对不起,是b等于,那么就直接返回。
So I'm going to go over here, and I'm going to type test search-- I can type and if you look at your handout, it's just a sequence of tests that I'm going to do OK. So initially, I'm going to set up the list to be the first million integers.
大家可以看看你们的课堂材料,那儿有一些我要做的实验,好,一开始我先去建立个,含有一百万个integer的数组,对,这有点儿简单,但是这给我提供了这样一个有序的数组。
应用推荐