And I'm going to show you an example in a 1 second, just to drive this home, but notice the characteristics. In the first two cases, the problem reduced by 1 at each step.
在前面两个例子里,每一部问题的规模缩小了,不管是迭代的还是递归的,这表明这个问题的复杂性可能是线性的。
Now. You might look at that and say, well that's just a lot like what we had over here Right? We had some additive constant plus a simpler version of the same problem reduced in size by 1.
现在你可能会看着这个说,这很像我们以前做过的,对不对?我们用一些附加的常量,加上问题的另外一个规模缩小了1的,简化版本来代替这个问题本身。
应用推荐