And then, when I got- I'm also going to count how many comparisons I do, just so I can see how much work I do here, and then notice what it does.
并能看到算法干了些什么-,然后是如果这个索引,比数组的大小小的话,就意味着还没检索到数组的最后。
Yeah, globalization is kind of one of those buzzwords nowadays , especially in IR,
全球化是目前的流行词之一,特别是在信息检索上,
And the change was, that in this case, if I'm doing a single search, I've got a choice.
这个改变是,在这种情况下,如果我要做单一检索,我就面临一个选择。
Done. All right? The basic, that primary search, because it looks at the first element, says it's smaller than everything else, I'm done.
以及其他的元素,检索完成,让我试试二分法呢?,可能会用更长的时间,请注意这里的输出。
I'm going to set up an index, which is going to tell me where to look, starting at the first part of the list, right?
索引告诉我从哪里开始检索数组,对不对?,然后我会去记录下我做了多少次比较,这样我就能看到这个算法的工作量了?
In binary search-- ah, there's that wonderful phrase, this is called a version of binary search just like you saw bin-- or bi-section methods, - when we were doing numerical things- in binary search, I need to keep track of the starting point and the ending point of the list I'm looking at.
就是当我们处理数字的时候,所称的二分检索,在二分法搜索中,我需要记录区间的开始点和尾点,初始化的时候就是-,问题输入的开始点和尾点,当我开始做测试的时候,我想要做的就是去取中值点。
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.
散列法的内容,此方法可以让我们在线性,时间内检索到键,因此字典的大小并不重要了。
And the example I want to look at is, suppose I want to search a list that I know is sorted, to see if an element's in the list.
看看目标元素在不在数组里,也就是说我要去,检索一个有序的数组。
In the basic case, oh, took a little while.
实际上,和上次检索-1的时候。
It says while the index is smaller than the size - of the list, I'm not at the end of the list and I don't have an answer yet, check.
当然是如果我还没检索到目标数的话,因此我会去看看是不是,这里真的看不情。
应用推荐