• But now, because my elements are going to take different amounts of memory, I'm going to do the following thing.

    因为我们元素大小不等,我们要这么做,在第一个点。

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

  • 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应该是合并后列表,下一个元素,然后你们就知道了。

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

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

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

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

  • The easy thing to do would be the following: start at the front end of the list, check the first element. If it's the thing I'm looking for, I'm done. It's there. If not, move on to the next element. And keep doing that.

    从数组的第一个元素开始:,如果这是目标元素那么结束,如果不是话就继续比较下面元素,并一直这么比较下去,但如果,在某一点我发现我要寻找数字。

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

  • If I look for, say, minus 1, you might go, gee, wait a minute, if I was just doing linear search, I would've known right away that minus one wasn't in this list, because it's sorted and it's smaller than the first elements.

    如果我要查找-1,你可能要怒了,呵呵,等一等,如果我用是线性查找,我不会知道-1不在这个列表中,但是列表是排好序,1又比第一个元素小。

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

  • Sure. So that says one should be the first element in my merge list.

    所以可以确定1应该是合并后,列表的第一个元素

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

  • It took me seven comparisons, because I can take advantage of the fact I know I only ever have to look at the first element of each sub-list. Those are the only things I need to compare, and when I run out of one list, I just add the rest of the list in.

    进行了7次对比,因为我可以利用我知道优势:,每次只需要比较每个子列表的第一个元素,那才是我需要进行对比内容,当一个列表元素处理完了,只需要将另一个列表剩下元素直接添加进去。

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

  • Again I should have said first, index 0, the first one. I can similarly go in and say I'd like all the things between index 2 and index 4. And again, remember what a b c that does. Index 2 says start a 0. 1, 2. So a, b, c.

    我还是要说一遍,索引为0元素,是第一个元素,我可以要求返回索引,2和4之前所有元素,请记住2,是从0开始,那么0,1,2对应是。

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

  • But I can also ask for parts of this. So I can, for example, say give me the first element of s1 string 1, s 1. Ah, that's exactly what we would have thought if this was represented as an ordered sequence of things.

    然后返回一个长字符串,我也可以,取字符串一部分,例如,我可以要求返回给我字符串,的第一个元素,啊,这证明我们之前,认为它是一个有序字符序列想法。

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

  • And what it's saying semantically is, using that variable as my placeholder, have it walk through this collection, starting at the first thing, execute that code, then the next thing, execute that code, and so on.

    语义意思就是,把这个变量应用为我占位符,用它来遍历这个集合,从第一个元素开始,执行代码,然后下一个元素,再执行代码。

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

  • By saying first element remember we start at as the initial indexing point.

    我们说的第一个元素是,最初开始索引点。

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

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

    我们将要调用这个二分查找,它将会在列表里面搜索元素,假定这里是,列表的第一个元素,那里是列表最后一个元素,代码内部到底做了什么?

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

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

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

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