I was able to take advantage of those opportunities,". Nearby,volunteer decorator George Torney of San Francisco is sorting and gluing yellow flower petals on the float that honors the airmen.
VOA: standard.2009.12.30
And so the fact that in this whole slide here, this algorithm for sorting, I'm using the verb sort.
在这个排序算法中,我用到了一个动词排序。
The fact that the picture is a little prettier on the far right is testament to the fact that I'm sorting the left half, the left half, the left half, and that's why you get these little triangles, triangles, triangles, that then get merged together.
可以看到最右边的画面,变化很快,先对左半部分排序,然后再左半部分,这就是为什么会有这些小三角形,最后再将它们合并起来。
They started having mail cars on trains and they started having postal sorting on the train.
人们开始用铁路邮政车,并且在火车上分类整理。
OK. Having said that, let's look at doing some sorts. And I'm going to start with a couple of dumb sorting mechanisms. Actually, that's the wrong way saying it, they're simply brain-damaged, they're not dumb, OK?
我们来做些排序吧,我要开始处理一些愚蠢的排序机制,事实上,我说的不正确,他们就是没脑子,不是笨,发明出来后,他们就在不停的被挑战?
And this is where it feels like we're not really doing anything except talking about sorting.
在这儿,似乎我们并没真正做什么而只是,在空谈排序。
Selection sort too really reduces to a total number of comparisons because I'm again comparing the current smallest to the next thing I see, the next thing, so really a lot of these sorting algorithms boil down to comparisons and the numbers that you actually have to make.
选择排序也可归纳为总数的比较,因为要将当前最小者与下一个进行比较,接着再下一个,可见,很多排序算法都可归结为比较,以及需要比较的次数。
So to just preface what we're going to do next time, what would happen if I wanted to do sort, and rather than in sorting the entire list at once, I broke it into pieces, and sorted the pieces, and then just figured out a very efficient way to bring those two pieces and merge them back together again?
所以为了引导下一次,我们要讲的内容,如果我想做排序,而且不是一次吧整个列表排完,会发生什么,我把它拆成小的列表,然后把各个小列表排序,接着用高效的方法再把小的列表?
And the context of sorting, the worst case is your handed a problem that's in complete reverse order because that implies you have - to do as more work that could possibly-- that you could-- you have to do more work than you would of course if things were in perfect order.
在排序的环境中,最糟糕的情况是待排序的序列是,完全逆序的,在这种情况下,你不得不做更多的工作-,比起一个较理想顺序的序列,你必须花费更多的努力。
So supposed that I give you 16 elements to sort, well, following the logic before, the running time involved in sorting 16 elements is gonna be twice the running time 16 of sorting 8 elements, left half and right half plus 16 - and again, a little sanity check, 16 means-- just the merge steps, right?
现在要对16个元素进行排序,根据之前的逻辑,对16个元素排序,要花的时间是对8个元素排序所花时间的,2倍,分别用于左半部分和右半部分,再加上6,这里16是-,做合并的步数,对吗?
So I propose this as a new algorithm for sorting N elements and being 8 in this case or really a thousand in the case of the phonebook, or anything of larger size.
所以我提出一种新的算法,来解决N个元素的排序问题,在这个问题中N是8,在电话簿的问题中N是一千,或者是大规模的任何问题。
And that's just a way of reminding you that we want to think carefully, but what are the things we're trying to measure when we talk about complexity here? It's both the size of the thing and how often are we going to use it? And there are some trade offs, but I still haven't said how I'm going to get an n log n sorting algorithm, and that's what I want to do today.
这只是在提醒你们我们要仔细的思考问题,但是当我们在讨论复杂性的时候,我们到底要衡量哪些东西?,是列表的大小和对其进行查找的频率吗?,这里面临一些取舍,但是我还没有说明,怎样得到一个n,log,n复杂度的排序算法,并且这是我今天想要讲的内容。
应用推荐