And I want to show you a little bit more detail of that, so let's create a simple little list here.
我还想给你们再讲详细些,那让我们来创建一个简单的列表吧。
So now here's the idea. I build a list 256 elements long, and I fill it up with those special characters none.
所以这里就是这种思想6,我创建了一个可以放下256个元素的列表,然后我以这些没有实际意义的字符将其填充。
Remember we said we design lists so that the access, no matter where it was on the list was of constant time.
记住我们说过我们创建了,一个列表它就是这么访问的,无论它在列表的哪个位置。
I'm going to build a list. Right, you can see that little loop going through there.
我要创建一个列表,是的,你可以看到这里有一个小小的循环。
I did not want to make a list, I wanted to create a tuple thank you for catching it. I want parens not square brackets there.
为什么这里有错误了,我并不想要创建,一个列表,我想创建一个元组,谢谢你,发现了这个错误。
So, what's the idea? If I know what my hash function does, it maps, in this case characters into a range zero to 256, which is zero to 255, I create a list that long, and I simply mark things.
我知道我的哈希函数做什么,在这个例子中,它将字母,映射成0到255的256个数字,我创建了一个这么长的列表,并且我只是简单的标志这些东西。
I'm returning that as my set.
所以我在创建一个列表。
应用推荐