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

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

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

  • We started off talking about binary search, and I suggested that this was a log algorithm which it is, which is really kind of nice.

    我告诉了你们这是一个对,数级的算法,这是很棒的,我们来一起看看这个算法到底做了什么。

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

  • So, the curious thing about recursion is that pretty much always can you implement this idea of doing the same thing again and again and again but with smaller bytes each time.

    可见,递归算法中新奇的一点是,为了实现一个想法,你可以一遍又一遍地做相同的事情,但每次的规模都会有所减小。

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

  • And the obvious question I could start with is, and suppose I ask you, how long does the algorithm implemented by this program take to run?

    我开始这个话题的第一个问题是,假设我问你,由这个算法实现的程序大概,要运行多久才能给出答案?

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

  • And that's because that is a version of a divide and conquer algorithm.

    这个想法非常重要,因为这就是分而治之算法一个版本。

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

  • Where those pieces, I would do the same thing with, I would divide them up into smaller chunks, and sort those. Is that going to give me a more efficient algorithm?

    合并起来,而那些小列表,我又会把他们拆成更小的列表,再排序,这会给我,一个更高效的算法么?

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

  • And probably the obvious thing you'll think about is, we'll come up with a clever algorithm. And I want to disabuse you of that notion.

    可能你想到的最有效的方法,就是设计一个,聪明点的算法了,这正是我想你们注意到的。

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

  • Alright, so we can implement any number of algorithms using this thing because the basic mechanism I have here is a comparator.

    好了,利用它我们可以实现,很多种算法,因为在此我用到的基本原理是一个比较器。

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

  • And so one of the things we'll look at today is how can we leverage an algorithm, how can we implement an algorithm that at least at first glance the second time we've now seen it feels so obviously better.

    因此,今天我们要学习的一点就是,我们怎样才能影响一个算法,怎样实现一个算法,使你在第二次看它时会觉得,至少比你第一次看到它时更好。

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

  • A really nice algorithm. As I said, an example of divide and conquer.

    真的很好的一个算法,就如我说的。

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

  • 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.

    选择排序也可归纳为总数的比较,因为要将当前最小者与下一个进行比较,接着再下一个,可见,很多排序算法都可归结为比较,以及需要比较的次数。

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

  • Linear algorithms tend to be things where, at one pass-through, you reduce the problem by a constant amount by one. If you reduce it by two, 1 it's going to be the same thing.

    有问题么?,线性复杂度的算法,当进行了一个,常量级步数的操作的时候,将问题的规模缩小了一个

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

  • All right? I don't care what's in there, but just assume that's my list. And just to remind you, on your handout, and there it is on the screen, I'm going to bring it back up, there's the little binary search algorithm.

    好,我不管列表里是什么,就假定那是一个列表,要提醒你们的是,在你们的讲义上和屏幕上,有一个简单的二分查找算法

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

  • The message I'm trying to get to here, because I'm running you right up against time, is I have to be careful about what's a primitive step.

    我想说的事情是,因为我正在跟大家讲算法时间复杂度,我们需要注意一个基本步骤的定义,如果我可以假设。

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

  • Where have we implemented a greedy algorithm, or have been asked to do a greedy algorithm? Well, there are not that many things you guys have been working on this semester.

    现在你已经实施了一个贪婪算法,我们在哪里实施了贪婪算法,或者我们那里被要求实施贪婪算法呢?,们这学期不需要用什么功对吧?

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

  • And we want to help you learn how to map a problem into a class of algorithms of some efficiency That's our goal.

    学会如何将一个问题,映射到一类,提升效率的算法中去,这就是我们的目标。

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

  • And we can just extrapolate in a straight line We before saw some examples where I had an algorithm to generate points, and we fit a curve to it, used the curve to predict future points and discovered it was nowhere close.

    我们可以干脆用一条直线来描述它,我们之前看到在一些例子中,我用一个算法去生成一些点,然后用一条曲线对它进行拟合,然后用这条曲线来预测未来的点,最后却发现结果完全不对。

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

  • If I'm running a linear algorithm, it'll take one microsecond to complete.

    算法会在1微秒内完成,如果是一个平方级的方法。

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

  • And finally, we saw an example of an exponential algorithm, those Towers of Hanoi.

    最后,我们来看一个,指数算法的例子,汉诺依塔的例子。

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

  • And part of it is we want you to learn how to have a catalog, if you like, of different classes of algorithms, so that when you get a problem, you try and map it into an appropriate class, and use the leverage, if you like, of that class of algorithms.

    另外我希望你们能学会,如何制作一个关于,算法不同课程的目录,这样当你碰到问题的时候,你可以去找到合适的课程,然后在那门课程中,寻找解决方法。

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

  • So he's packing and unpacking, packing and unpacking, trying all possible combinations of objects that will obey the constraint. And then choosing the winner. Well, this is like an algorithm we've seen before. It's not greedy.

    因此它不断装包和清包,尝试了所有满足约束条件的物品组合,最后选择最优者,这很像我们以前看过的一个算法,这不是贪婪算法

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

  • Which of these algorithms is better?

    一个算法更好呢?

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

  • Let me generalize this slightly.

    但是这是一个非常不错的算法

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

  • So the first one here is something called insertion sort which amounts to going through the list, taking the first thing that you see and inserting that element into its correct place, - then moving on to the next one, dealing with what element-- whatever element you're given and putting it in its right place.

    首先是插入排序,在此算法中,需要遍历整个列表,将你遇到的第一个元素放在其正确的位置,然后移动到下一个元素,继续处理-,不管是什么元素,都将其插入到合适的位置。

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

  • 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.

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

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

  • 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.

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

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

  • It's a good sign that this is logarithmic, and I'm going to come back in a second to why logs are a great thing.

    为什么对数级复杂度是个好事情,让我们再来看一个算法,噢,抱歉是让我们再来看两个算法

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

  • It is certainly possible, for example, that a quadratic algorithm could run faster than a linear algorithm. It depends on what the input is, it depends on, you know, what the particular cases are. So it is not the case that, on every input, a linear algorithm is always going to be better than a quadratic algorithm.

    一个二次平方级复杂度的算法,当然也是可能跑的比线性复杂度算法快的,这取决于,你知道的,输入以及特定的案例,因此并不是对于每个输入,线性复杂度就一定会,比二次平方级复杂度的算法的表现要好,只是通常来说是这样的。

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

  • Notice here that it's different than the binary search case. We're certainly dividing down, but the combination now actually takes some work. I'll have to actually figure out how to put them back together. And that's a general thing you want to keep in mind when you're thinking about designing a divide and conquer kind of algorithm.

    一个分治的例子,注这里,与二分查找所不同的地方,我们肯定是分解了,但是合并的过程还是需要一些工作量的,我会详细说明怎样把它们合并在一起的,当你在考虑设计一个分治算法时,这是你要必须记住的最基本的东西。

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

  • I think one of the classic ones for strings is called the Rabin-Karp algorithm. And it's simply the same idea that you have a mapping from your import into a set of integers.

    我认为字符串哈希,最经典的是Rabin-Karp算法,它只是简单的相同概念,你有一个映射关系将你的输入映射成一组数字。

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

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

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

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