So it doesn't matter how big the dictionary is, you can instantaneously retrieve the value associated with the key. Extremely powerful.
因为你可以在线性时间,内得到想要的键对应的值,这太强大了。
Any thoughts? Don't you hate professors who stand here waiting for you to answer, even when they have candy?
你们难道不讨厌站在那儿等你回答问题,的教授么?虽然他有糖果做奖品哦,用少于线性时间完成可能么?
I've got to do another pass. Huh. Sounds like a linear number of times I've got to do- oh fudge knuckle.
冒到最后去,还得再做冒泡,呵,听起来我要做线性次的时间-,哦,胡说八道。
And that's the kind of instinct I'd like you to get into thinking about. So the answer here is no.
所以答案是否定的,好的,那我们能在线性时间内排序么?
That one's not so obvious. So let's think about this for a second. To sort a list in linear time, would say, I have to look at each element in the list at most a constant number of times.
所以让我们来思考一会,要在线性时间能排序,列表里每个元素最多被使用常数次,不一定是一次,对吧。
Dictionaries are implemented using a magic technique called hashing, which we'll look at a little bit later in the term, which allows us to retrieve keys in constant time.
散列法的内容,此方法可以让我们在线性,时间内检索到键,因此字典的大小并不重要了。
The gentleman has it exactly right.
我怎么可能在亚线性时间内完成呢?
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教授已经说过这一点了,在一些语言中取得数组,要花费时间是线性长度的。
应用推荐