Yeah, it's kind of simple, but it gives me an ordered list of these things, And let's run it. OK.
让我们来运行运行吧,好,我会先去搜索一些数组中没有的元素,让我来试试,看-1在不在这个数组里。
And what does that say? It says, let's assume I want to do k searches of a list. OK.
如果我们假定要在列表中做k次搜索,在线性的情况下,假定是一个未排序的情况。
They of course still own the film but the digitized portions of it and then to create out of internet the various representations of that so people can search this archive.
当然版权还是他们的但是,通过网络创建电子版,这样人们可以,从这个电子档案馆中进行搜索。
We came up with this idea that we open up the interface so that people who owns the data, who owns the content, can submit it to us and we will integrate into our search results.
于是我们有了一个想法,开放一个接口,让拥有数据,以及容量的人,能够将其提交给我们,然后整合到搜索结果中。
If we could do sort, then we saw, if we amortized the cost, that searching is a lot more efficient if we're searching a sorted list.
如果我们可以做排序,然后我们可以看到,如果我们分摊开支,在有序列表中搜索将会变得更高效。
I'm going to call it down here with search, which is simply going to call it, and then print an answer out.
然后返回答案,在二分法搜索中,其实有个挺美妙的名称。
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.
就是当我们处理数字的时候,所称的二分检索,在二分法搜索中,我需要记录区间的开始点和尾点,初始化的时候就是-,问题输入的开始点和尾点,当我开始做测试的时候,我想要做的就是去取中值点。
In the linear case, meaning in the unsorted case what's the complexity of this? k times n, right? Order n to do the search, and I've got to do it k times, so this would be k times n.
复杂度是多少?k的n次方,对吧?,在序列n中做搜索,要做k次,所以是k的n次方次,如果先排序后搜索。
This is a search box that every Chinese is familiar with, but when you look at people's needs, people are typing all kinds of queries in this box. For example... "A great MP3", "Where can I find a girlfriend in Beijing?"
这是一个中国人都很熟悉的搜索框,但是当关注到人们的需求时就会发现,人们在框中输入,各种关键字。,比如,“听起来让人觉得开心的MP3“,“北京哪里能找到女朋友结婚?“
应用推荐