The notion here is that you can get a globally optimal solution from locally optimal solutions to sub-problems.
这里的概念是你可以通过,子问题的局部最优方案,得到全局优化解决方案。
And so you could construct all subsets, check that the weight is less than the weight of the knapsack, and then choose the subset with the maximum value.
因此你可以构建所有子问题,判断它的重量,是否小于背包的重量,然后选择值最大的子问题。
OK. And then the exponentials, as you saw is when typically I reduce the problem of one size into two or more sub-problems of a smaller size.
好,然后说到指数级,正如你所见,典型的例子是,我讲一个问题分解成为,两个更小规模的子问题。
Or a subset with the maximum value, there may be more than one, and you're done.
或者是有最大值的子问题集,可能不只一个子问题符合条件,然后就解决问题了。
And the reason it does is because of this overlapping.
但是它增长的很快,原因就是它的重叠子问题。
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.
因此被称为分治的原因就这么简单,将一个问题分解成一些子问题,并希望这些子问题解决起来比较方便,正如你希望的,求解的过程也会变得简单,下面就是把结果合并起来,现在,在二分搜索的例子里,从某些方面来说,这有点微不足道。
One was overlapping sub-problems.
一件就是重叠的子问题。
应用推荐