Let's check it out. I've written a little bit of a test script here, so if we test cell sort, and I've written this so that it's going to print out what the list is at the end of each round, OK.
我们来检查检查,我写了一个小测试脚本,我写这个脚本来测试单元排序,它能够打印出每一轮结束后,链表的是什么样子的。
Having reached the end of the block, go back up and check the test.
执行到了这块代码的最后,程序会回去再做一次测试。
And that idea was, we make a guess in the middle, we test it so this is kind of a guess and check, and if the answer was too big, then we knew that we should be looking over here. If it was too small, we knew we should be looking over here, and then we would repeat.
这些有理数是有序排列的,然后我们的想法是,首先在中间取个数作为猜想数,然后对这个猜想数进行验证,如果由猜想数得到的答案太大,我们知道应该跳过,比猜想数大的那个区间,如果太小的话。
应用推荐