First, it's pointing to the beginning of the list, which initially might be down here at but after a while, might be part way through. And to that, I simply add a halfway point, and then I check.
列表中间的一个部分了,然后我求出列表的中值点,然后看看该点的值是不是等于目标值,如果是的话就完成了,如果不是的话,如果中位值大于我要找的目标值。
All right, and let's just check this out, because I want to make a point of this, let's go back and do the following.
好,让我们记住这一点,因为我想要强调下这里,我们回过头去做如下的操作:
I need that sanity check saying at some point, you have to stop.
在一些地方需要做那样的合法性检查,告诉你必须停止操作。
My point is, go check the course website, which by the way is right there.
我的意思是你们要去核查一下,课程网站上的正确时间。
At this point in the story, I now check while n is less than 1, what do I do?
在此时此刻,我现在在检查当n小于1是,我做什么?
So now, in this case, this code is going to, when we get here, check, and if you haven't seen that strange thing there, that exclamation point in bang computer-ese called a bang, it says x if ANS star ANS is not equal to x, all right?
那么现在,在这个例子中,当我们执行到这里,代码会去检查,如果你没有看到过这个奇怪的东西,这个感叹号在计算机学中被叫做,代码的意思是如果ANS的平方不等于?
So this do while loop immediately breaks out at the point of that check.
所以这个do,while,循环在检查的时候,直接中断了。
应用推荐