• You'll also notice that this thing goes through the entire list, even if the list is sorted before it gets partway through.

    你也能注意到,它始终会遍历列表,甚至列表在排序之前,就是有序的也是这样。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Let's do selection and let's do merge sort here on the right just to see what actually happens.

    中间进行选择排序,右边进行归并排序,看看会发生什么。

    哈佛公开课 - 计算机科学课程节选

  • I haven't said how I'm going to get those sorted lists, but imagine I had two sorted lists like that.

    我还没有说明我怎么才能得到已排序的列表,但是想像一下我现在已经有,两个已排序好序的列表了。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • What's shown in this diagram is the progress of the developing embryo as it travels in time, down the fallopian tube.

    这张图上显示的,就是胚胎发育的过程,是按照它在输卵管中移动的时间排序

    耶鲁公开课 - 生物医学工程探索课程节选

  • It has to be the atomic arrangement.

    就是由于原子的排序

    麻省理工公开课 - 固态化学导论课程节选

  • So basically, at the time he was just going on size and then traits, but what we actually know today is that we can also order things in the periodic table by electron configuration.

    基本上,在当时他只能通过大小,和特性来进行,但是现在我们已经知道了,我们还可以通过电子排布来对它们进行排序

    麻省理工公开课 - 化学原理课程节选

  • And this is in contrast to Selection Sort where you're fishing again and again for the then smallest element.

    这与选择排序是相反的,在选择排序中你需要一次又一次地,找出最小的元素。

    哈佛公开课 - 计算机科学课程节选

  • And so the fact that in this whole slide here, this algorithm for sorting, I'm using the verb sort.

    在这个排序算法中,我用到了一个动词排序

    哈佛公开课 - 计算机科学课程节选

  • And that's the kind of instinct I'd like you to get into thinking about. So the answer here is no.

    所以答案是否定的,好的,那我们能在线性时间内排序么?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • If it was an unordered list, we were basically stuck with linear search. Got to walk through the whole list to see if the thing is there.

    如果是一个未排序的列表,基本上我们就只能使用线性搜索了,通过遍历整个列表来查看。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I'm gonna tell you go sort the left, go sort the right, and then I'll merge the two together.

    那先对左半部分排序,再对右半部分排序,然后将两者合并起来。

    哈佛公开课 - 计算机科学课程节选

  • It implies that this algorithm is calling itself again and again, and again, and on each time the size of the problem I'm trying to sort is being divided by what?

    这就说明此算法会一次又一次地调用自己,每次我要排序的问题规模大小,会除以多少呢?

    哈佛公开课 - 计算机科学课程节选

  • Just contrast this for a brief moment to something like Selection Sort which from the get go had a ridiculous amount of redundancy comparing the same damn numbers again and again, and again.

    这就与其他的排序算法形成了鲜明的对比,比如选择排序,它会一次又一次地做,多余的比较。

    哈佛公开课 - 计算机科学课程节选

  • And in fact, if we count up all of these silly comparisons I was making verbally I bet I'm gonna be making fewer in the end than I was with bubble or with selection.

    事实上,如果将所有的,比较次数加起来,我敢打赌,比起冒泡和选择排序,它最终的比较次数是相对较少的。

    哈佛公开课 - 计算机科学课程节选

  • I hope you can see this because I'm going to try and simulate what a merge sort does. I've got eight things I want to sort here, and those initially start out here at top level.

    我希望你们认真看,因为我要尝试着模拟出归并排序的操作过程,这里我有八个元素进行排序,第一步是将它们分成两半,对吗?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Merge sort takes this idea of divide and conquer, and it does the following: it says let's divide the list in half.

    归并排序以如下的步骤使用了分治思想:,把列表分成两半:,下面就是分治。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Let's check it out. I've written a little bit of a test script here, so if we test cell sort, and I've written this so that it's going to print out what the list is at the end of each round, OK.

    我们来检查检查,我写了一个小测试脚本,我写这个脚本来测试单元排序,它能够打印出每一轮结束后,链表的是什么样子的。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Alright, so bubble of sorts of course is being poked fun at there for what reasons?

    冒泡排序在这儿显然是被拿来开玩笑了,那么原因是什么呢?

    哈佛公开课 - 计算机科学课程节选

  • We looked at something called Selection Sort and that too was pretty straightforward, at least conceptually.

    例如选择排序,至少从概念上来说,它非常简单。

    哈佛公开课 - 计算机科学课程节选

  • And this is where it feels like we're not really doing anything except talking about sorting.

    在这儿,似乎我们并没真正做什么而只是,在空谈排序

    哈佛公开课 - 计算机科学课程节选

  • So this is a nice little search-- sorry, a nice little sort algorithm . And in fact, it's relying on something that we're going to come back to, called the loop invariant.

    恩,这是一个很棒的小搜索,抱歉,和很棒的小排序算法,事实上,它依赖于一些我们要回顾的东西,被称作循环不变量。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Run merge sort on those. By induction, if it does the right thing, I'm going to get back two lists, and I'm going to then merge Them together. Notice what I'm going to do.

    在这些上面再运行归并排序,根据归纳,如果这样是正确的,我将重新得到两个列表,然后我会把它们合并在一起。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • And what does that say? It says, let's assume I want to do k searches of a list. OK.

    如果我们假定要在列表中做k次搜索,在线性的情况下,假定是一个未排序的情况。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • We're gonna focus on this line in particular and ask ourselves how do you sort the left half.

    我们应该集中于这一行,并自问一下该如何对左半部分排序

    哈佛公开课 - 计算机科学课程节选

  • OK, what I would like you to see is I've been printing out, as I went along, actually let's back up slightly and look at the code. There's merge sort.

    好的,我想让你们看就是我运行过后,打印出来的结果,我们再回头看一下这段代码,这就是归并排序,输入一个列表。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • As soon as I return, I get to resume this story which means sort the right half, so that means sort this half here.

    一旦返回,就应该,对右半部分排序,也就是说对这边的一半进行排序

    哈佛公开课 - 计算机科学课程节选

  • So this plus plus is sort of shorthand notation for incrementation. So just add 1 to this variable's value, so now socks on feet is of course 1 and so next.

    那么这个++符号是递增排序的,所以仅仅是对这个变量加一,现在袜子在脚上是一,那么下一个也是这样。

    哈佛公开课 - 计算机科学课程节选

  • Now, I'll do this a bit more on automatic pilot so that it doesn't get too tedious, but let's do the same thing.

    现在我可以熟练地进行排序,所以不会太沉闷,下面进行同样的步骤。

    哈佛公开课 - 计算机科学课程节选

  • They are computationally challenged, meaning, at the time they were invented, they were perfectly good sorting algorithms, there are better ones, we're going to see a much better one next time around, but this is a good way to just start thinking about how to do the algorithm, or how to do the sort.

    他们是相当棒的排序算法,是有更好的算法,我们下一次,就会看一个更好的,但是开始想想,如何完成算法,或者说是如何排序,是一个好的学习方法,恩,再试试吧,如何来排序呢?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Well, we saw the teaser in terms of that animation that suggests this merge sort algorithm when implemented by a computer is absolutely faster.

    我们从前面的动画中可以看到,这个归并排序算法在计算机上实现之后,绝对比其他算法更快。

    哈佛公开课 - 计算机科学课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定