• I've written a little for loop, which is going to iterate over all of the elements in the list.

    让我们先看看这儿的代码,我已经写了一个循环语句,用来迭代处理数组所有的元素。

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

  • Yeah, it's kind of simple, but it gives me an ordered list of these things, And let's run it. OK.

    让我们来运行运行吧,好,我会先去搜索一些数组没有的元素,让我来试试,看-1在不在这个数组里。

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

  • Oh, look. In my array at top left, they have now cherries in it.

    在左上方的数组,已经有樱桃了。

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

  • And then I say, oh you know I've used lists all over this program. I'll bet this isn't the only place where I've made this mistake.

    变化引起的边缘效应,然后我的意思是,你知道的我在这个程序一直都在用数组,我敢打赌我犯了这种错不止一次。

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

  • When you are searching a list to see whether it has an element, you don't randomly probe the list, hoping to find whether or not it's there.

    当我们在一个数组,寻找目标元素的时候,我们不会随机的调查数组来看。

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

  • But if, at any point, I get to a place in the list where the thing I'm looking for is smaller than the element in the list, I know everything else in the rest of the list has to be bigger than that, I don't have to bother looking anymore.

    比当前位置数组的元素要小,我也就知道后面的数肯定,也都比我的目标数要大了,我就不用再继续进行下去了,这意味着目标数不在这个数组,我就可以退出了。

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

  • The better way to think about this is, suppose, rather than starting at the beginning, I just grabbed some spot at random, like this one.

    不从数组的头开始遍历,我随即的从数组抓一个元素,比如这个,我去看看这个元素的值。

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

  • The worst case here is, the things not in the list in which case I've got to go all the way through the list to get to the end.

    目标数不在数组里,这意味着我必须遍历数组所有的元素,好,说完了这些。

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

  • But we know lists can be composed of anything.

    数组取得目标元素,是一个基本步骤。

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

  • And in this context, the length of that array is stored in Arg C. Well, let's take a look at a slight variance of this that reveals further what we can do and reveals what a string really is.

    关于这点,那个数组的长度被存储在ArgC,好的,让我们看看这个轻微的变化,那个揭示了我们可以做的,和字符串实际上是什么。

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

  • So, suppose I want to remove something.

    假设我想在数组移除一些东西。

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

  • It's not true, by the way, of all programming languages. In fact, Professor Guttag already talked about that, in some languages lists take a time linear with the length to get to it.

    顺便说一句这在大部分,编程语言做不到,实际上Guttag教授已经说过这一点了,在一些语言取得数组,要花费时间是线性长度的。

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

  • We can put a list in the list again, as we've seen before. So let's put the list containing the string a, and I'll print out so now we see something pretty interesting about a list, that we can mix up all sorts of things in it, and that's OK.

    数组放到数组去,让我们把这个包含,字符串a的数组放进去,然后再显示,我们看到了一些,挺有趣的事情:我们可以把各种,各类的东西混合着放进去,没问题。

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

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

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

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