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.
就是当我们处理数字的时候,所称的二分检索,在二分法搜索中,我需要记录区间的开始点和尾点,初始化的时候就是-,问题输入的开始点和尾点,当我开始做测试的时候,我想要做的就是去取中值点。
And when I do this test, what I want to do, is say I'm going to pick the middle spot, and depending on the test, if I know it's in the upper half, I'm going to set my start at the mid point and the end stays the same, if it's in the front half I'm going to keep the front the same and I'm going to change the endpoint.
如果我知道目标数可能,再比中值点大的区间里,我可能就会把开始点设为中值点,而尾点不变,如果在小的那个区间里,就保持开始点不变而把尾点设为中值点,你们可以看到这儿的代码,就是这么做的,对不对?它是怎么做的?
- And we could never do this-- and one could never do this experiment today but let me go through it with you and you'll apologize for its--some of its qualities.
我们不能再-,这种实验,如今再不能做了,我给你们从头至尾讲一下,因为实验中性别歧视的原因,我再次道歉。
So rather than go through this again a whole third time, I've gone through it once in quantities and once in prices, I'm going to get you guys to do it this time by having you do it on a homework assignment.
与其从头到尾再做第三遍,我已经从产量和价格角度从头到尾做过了,我将让你们自己,在家庭作业中完成这个工作
应用推荐