How do we take a complex program, again, divide and conquer, I feel like a 1-trick pony, I keep repeating the same thing over and over again.
同样的先分解再逐个击破,我就像只会一个把戏的小马,我不断重复相同的事情。
So if I try to apply the same logic, well how can I divide and conquer this problem.
如果我想要用同样的逻辑,那么怎样划分,并解决这个问题呢?
A really nice algorithm. As I said, an example of divide and conquer.
真的很好的一个算法,就如我说的。
And it's called divide and conquer for the obvious reason. I'm going to divide it up into sub-problems with the hope that those sub-problems get easier. It's going to be easier to conquer if you like, and then I'm going to merge them back. Now, in the binary search case, in some sense, this is a little bit trivial.
因此被称为分治的原因就这么简单,将一个问题分解成一些子问题,并希望这些子问题解决起来比较方便,正如你希望的,求解的过程也会变得简单,下面就是把结果合并起来,现在,在二分搜索的例子里,从某些方面来说,这有点微不足道。
I have used divide and conquer, as we seen before, to recursively break it into smaller problems. But the smaller problem of fib of 4 and the smaller problem of fib of 3 overlap with each other.
正如我们之前看到的,我已经进行了划分,并且递归性的把它分解为更小的问题,但是fib的简化问题,和fib的简化问题会相互重叠。
应用推荐