Now,the U.S.government is changing the rules to require airlines to check the no-fly list within two hours after being notified of changes.
VOA: standard.2010.05.06
The easy thing to do would be the following: start at the front end of the list, check the first element. If it's the thing I'm looking for, I'm done. It's there. If not, move on to the next element. And keep doing that.
从数组的第一个元素开始:,如果这是目标元素那么结束,如果不是的话就继续比较下面的元素,并一直这么比较下去,但如果,在某一点我发现我要寻找的数字。
It says, well I'm going to print out first and last just so you can see it, and then I say, gee 2 if last minus first is less than 2, that is, if there's no more than two elements left in the list, then I can just check those two elements and return the answer.
然后它计算了尾点和开始点的差,如果小于2的话,也就是说数组中的元素小于等于,我对这两个元素进行比较,然后返回结果就可以了,否则的话,我们就去寻找中值点,注意它是怎么实现的,首先这个指向一个列表的开头。
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.
当然是如果我还没检索到目标数的话,因此我会去看看是不是,这里真的看不情。
You try to design actually I'm going to come back to that in a second. It's like you're trying to use a hash function that spread things out pretty evenly. But the places you store into in those lists may have to themselves have a small list in there, and when you go to check something, you may have to do a linear search through the elements in that list.
你尝试着去设计,实际上过会儿我会回头讲解这个问题,类似于你需要用一个哈希函数,非常平均的将物体分发出去,但是在列表中你数据,映射到的地方可能会有自己的一小段列表,当你回头查找数据的时候,你可能需要在那一小段列表中做线性查找。
So I'm going to check to see if- really can't read that thing, let me do it this way-- right, I'm going to increase the number of compares, and I'm going to check to say, is the thing I'm looking for at the i'th spot in the list?
让我们这样做吧-好-,我会去增加比较次数的计数器,然后去看看在第i处的元素,是不是我要找的呢?,这里s的意思就是,给定数组的?
Now if you look at that list, there is actually something I didn't seem to check, which is, I said I wanted a float stored in hyp.
看下上面的清单,实际上我还有一些东西忘了检查,也就是说hyp中存储的,应该是浮点数类型。
应用推荐