"But they illustrate what I want to try to do in this book,which is to just broaden the thinking to get away from this traditional sort of radio search.
VOA: standard.2010.04.16
We actually threw half of the list away and we kept dividing it down, until ultimately we got something of size one to search.
我们实际上将另一半的列表给抛弃了,我们接着不断的如此分解下去,直接最终我们搜索到了唯一的一个元素。
OK. So, what do I want you to take away from this? This idea of binary search is going to be a really powerful tool. And it has this property again, of chopping things into pieces.
从这里学到些什么?二分查找的思想,是一个非常有用的工具,我重复一遍,把问题拆成几部分来解决,那事实上,这里的增长率是多少?
If I look for, say, minus 1, you might go, gee, wait a minute, if I was just doing linear search, I would've known right away that minus one wasn't in this list, because it's sorted and it's smaller than the first elements.
如果我要查找-1,你可能要怒了,呵呵,等一等,如果我用的是线性查找,我不会知道-1不在这个列表中,但是列表是排好序的,1又比第一个元素小。
应用推荐