I've thrown away most of the array- most of the list, I shouldn't say array- most of the list. All right?
我已经把数组的大部分都排除了-,列表的大部分-,我不应该说数组-列表的大部分?
If I want to create a set or a sequence representing these things, I simply insert into that list.
如果我想创建一个集合,或者一个序列表示这些东西,我只要简单的把它插入列表中。
These things run for variable amounts of time because they take input, a list of size of some amount.
而这一段的执行时间是可变的,因为它们需要输入一个包含一些元素的列表。
Where Aristotle made the courage of men in combat a central virtue of his ethics, Hobbes pointedly omits courage from his list of the moral virtues.
亚里士多德把战争中,勇敢的人作为最高美德,而霍布斯恰恰是把勇敢,从美德的列表里删掉了。
Let me also add that I have a reading list that has clickable things on it and also things that are on reserve in the library.
还有一点,我还有个阅读材料列表,其中有可点击的网络连接,也有可以在图书馆读到的内容
There's a list, a finite list, of possible sounds that language can use.
语言使用的可能声音列表是有限的
There's a partial list that's shown here, starting the top of the list with smallpox, and that's what we're going to spend most of the time talking about today.
这是列表的一部分,表上第一个是天花疫苗,今天我们要用大部分时间讨论它
Now, there are Greek traditions that are taken seriously by the Greeks that suggest that kings ruled these cities from the beginning and they have lists of kings with their names, and sometimes with stories attached to them.
古希腊人有他们一些严格执行的传统,这些传统暗示这些城邦一开始就由国王统治的,他们甚至有国王的名字的列表,有时还有关于国王的传说
I haven't said how I'm going to get those sorted lists, but imagine I had two sorted lists like that.
我还没有说明我怎么才能得到已排序的列表,但是想像一下我现在已经有,两个已排序好序的列表了。
That got split in half, and that got split in half until I got to a list of one.
在那里被分成两半,然后在那里被分两半,直到得到长度为一的列表。
So supposed that the list is not of size 8, let's make it slightly more interesting and double it.
假如列表的大小不是,为了更有趣,使其加倍。
This is sorted, this is sorted, how do I now make a list of size 2?
这个是有序的,这个也是有序的,我怎样才能组成一个有2个元素的列表?
So it's certainly at least linear in the length of the list. For each starting point, what do I do?
它至少是线性的计算列表的长度,每次到了循环开始的点?
Now, compare the first element in each of these lists. Two is less than three, so two ought to be the next element of the list.
现在,比较每个列表的第一个元素,2要比3小,所以2应该是合并后列表的,下一个元素,然后你们就知道了。
And I want to show you a little bit more detail of that, so let's create a simple little list here.
我还想给你们再讲详细些,那让我们来创建一个简单的列表吧。
Well, notice again, on each level of the tree, when I actually do the merging, so this remember, is when I wrote down just the numbers when I bottomed out with the list of size 1.
请注意,在这棵树中的每一层,我真正做合并时,就将每个大小为1的列表中的,数字写下来。
First, it's pointing to the beginning of the list, which initially might be down here at but after a while, might be part way through. And to that, I simply add a halfway point, and then I check.
列表中间的一个部分了,然后我求出列表的中值点,然后看看该点的值是不是等于目标值,如果是的话就完成了,如果不是的话,如果中位值大于我要找的目标值。
So when I do the analysis, I want to think about what am I doing here, am I capturing all the pieces of it? Here, the two variables that matter are what's the length of the list, and how many times I'm going to search it?
这里,要关注的,两个变量是列表,的长度以及我要搜索的次数,这种情况下,这个算法赢了?
So now here's the idea. I build a list 256 elements long, and I fill it up with those special characters none.
所以这里就是这种思想6,我创建了一个可以放下256个元素的列表,然后我以这些没有实际意义的字符将其填充。
Remember we said we design lists so that the access, no matter where it was on the list was of constant time.
记住我们说过我们创建了,一个列表它就是这么访问的,无论它在列表的哪个位置。
I still have to do this process and here is where the finger thing gets a little more useful 'cause I have longer lists.
我仍需要进行这一步骤,在这儿手指的方法就比较有用,因为,列表比之前的要长。
Just point at the start of this list, and this one so which number comes first?
指向列表的开始处,对于它来说,哪个数字在前面?
Let me divide this into 2 lists of size 1 and now done, right?
那么我将其划分为只有1个元素的2个列表?
All right. Now. Some programming languages, primarily Lisp, actually store lists these ways.
就是这么保存列表的,你可能要问为什么。
And we said that was log rhythmic, took log n time where n is the size of the list.
当列表的长度为n的时候,整个算法耗时log,n的时间。
This one here, this one here, the lightest elements of each are where?
一个在这,另一个在这,每个列表中最轻的元素在哪呢?
What's this thing doing? It's walking along the list looking for the smallest thing in the back end of the list, keeping track of where it came from and swapping it with that spot in the list. All right?
这是在做什么?是在遍历列表,找列表后端最小的元素,跟踪它从哪里来的,然后同当前点的元素交换,明白了么?
It goes through and puts ones in the right place.
它遍历整个列表并提到正确的位置。
So it's now pointing to the end of the list.
现在它指向列表的末尾。
We're going to call binary search, it's going to take the list to search and the element, but it's also going to say, here's the first part of the list, and there's the last part of the list, Well, it checks to see, is it bigger than two?
我们将要调用这个二分查找,它将会在列表里面搜索元素,假定这里是,列表的第一个元素,那里是列表的最后一个元素,代码内部到底做了什么?
应用推荐