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又比第一个元素小。
应用推荐