Whereas in the linear case, I make it ten times bigger, it takes ten times longer to run. OK.
它要占用原来十倍的时间去运行,我一直在说还有一件事情没有讲,这是我要强调的最后一件事。
Notice one last piece. If I'm going to do that, run through all possible answers, I still want to know, gee, what if there aren't any answers? How do I return that case?
注意最后一段,如果我要这样做,也就是运行所有可能的答案,我还是想知道要是没有结果呢?,在这个例子中应该返回什么呢?
buggy3 But if I run this thing, buggy three, they've clearly not been swapped.
但是如果我运行它,它们显然没有交换。
And so when I run this program, nothing all that interesting happens.
所以当我运行这个程序,没有什么会发生。
I then click on the shell, rather than hitting F5, try and run it and say, it's not doing what I thought I should do.
然后我点击了命令解释程序,而不是按F5,我运行了程序而它,并没有按照我认为的那样做。
This code does swap the two values, A and B. However, when I run this program, something happens.
这个代码没有交换那两个值,A和B,但是,当我运行这个程序时,有些事情发生了。
Because, again, it seems simpler have a model where there's no momentum.
因为没有momentum的话会更简单,我现在第一次运行。
So the question was, why is this return down at this level, it says, well if I ever execute out of this FOR loop, I get to the end of the FOR loop without hitting that branch that took me through the return, then and only then do I want to actually say, gee, I got to this place, there isn't any value to return, none I'm going to return none and none.
问题是,为什么它是在这个级别上返回值呢,意思就是如果我出了这个for循环,就意味着我运行的过程中没有走到任何,带return的支路上去,这时也只有这时我才能说天呐,我终于走到这儿了,这时不会返回任何值,只会返回none和。
If it isn't, then I'm going to go back around the loop, and notice what happens. If I get all the way around the loop, that is, all the way through that FOR loop and I never find a path that takes me through here, then the last thing I'm going to do is return a pair or a tuple with a special simple number none twice.
如果没有,我会回到循环看看发生了什么,如果我运行了整个循环,也就是整个for循环,我仍没有找到符合条件的路径,那么我最后做的事情就是返回一对,或者一个数组的两次none值。
应用推荐