"My friends and I have made a list of things we want to do over the summer. Different places to travel, to get away to, maybe a beach a few hours away.
VOA: special.2010.06.18
These things run for variable amounts of time because they take input, a list of size of some amount.
而这一段的执行时间是可变的,因为它们需要输入一个包含一些元素的列表。
The question we're asking is, "Is there a good reason to add to our list of things there are?
我们的问题是,有没有一个很好的理由,让我们往已写有东西的清单上再添上几笔
Well let's see. My fall back is, I could just do linear search, walk down the list one at a time, just comparing those things. OK. So that's sort of my base. But what if I wanted, you know, how do I want to get to that sorted list? All right?
我只能做线性搜索了,一次遍历一遍列表,一个一个比较,但如果我想要,那怎样得到有序的列表呢?,现在的一个问题是,我们排序之前?
But they don't have a set list of things that make something the canon.
但他们没有列出一系列东西,让它们成为正典。
Because there are a lot more chemical-sounding things in that list of ingredients than there are things that nature would recognize or we would ordinarily recognize as food.
因为配料单里的很多东西,看上去更像化学成分,而不是我们通常认为的自然物质,或者常规意义上的食物
Well, you can use what's called an array which is kind of a list or a little satchel of that you might physically carry that you can put things in again and again, and with an array can you actually keep track of not just numbers but any kinds of things, other sprites or other pictures, or perhaps a little something like this.
你可以使用数组,它其实是个列表,或者说是个小包,你可以把东西一个个放到里面,通过数组你可以保存任何种类的变量,图片或者像,这个例子中的一些小变量,而不仅仅是数字。
I think the easiest way to look at what this does, is let's take a really simple example- I want to make sure I put the right things out- I've got a simple little list of values there.
到底做了什么,就是让它跑一个简单的例子,我想要确信我找到了正确的元素-,这里我用一个简单的小的列表-,如果我去代码里面看。
So, for example: in this case, my list is a bunch of integers. And one of the things I could take advantage of, is I'm only going to need a finite amount of space to represent an integer.
列表是一系列整数,要注意的这里的优势能够,用有限的空间来表示整数,例如,如果我想要操作。
Well, that program was interesting because it had an inventory which was implemented in Scratch with a list which is kind of like a container that you can add things to again and again.
那个程序很有趣,它有一个用Scratch做出来的清单,还有一个貌似容器的列表,你可以不断往里面加东西。
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的数组放进去,然后再显示,我们看到了一些,挺有趣的事情:我们可以把各种,各类的东西混合着放进去,没问题。
应用推荐