So things that are good candidates for divide And conquer are problems where it's easy to figure out how to divide down, and the combination is of little complexity.
因为适合用分治算法解决的问题,最好是能够简单的将问题进行分解,并且合并的过程不是非常的复杂,只要比线性方案要小。
Well, it's, you sort of know how you'd do it if this was grammar school right?
你怎么解决这个问题呢?,很简单?
I think that book will give you all the basic principles you need in calculus of one variable, more variables, elementary complex numbers, maybe solving some problems with vectors and so on, which you're going to get into.
我想那本书会给你所需的所有基本知识,包括一元和多元微积分,简单的复数运算,可以解决一些与矢量有关的问题,而这正是你们将要学的
We call that a base case. It's basically the simplest possible solution to the problem.
我们说这是一个基础案例,这是这个问题最简单的解决方案。
There are other problems that are much more naturally thought of in a recursive fashion.
有一些问题不递归,也可以很简单的解决。
We're going to do the same thing here, we're going to chart out a little bit of what should go into actually making this thing work.
我们要去画一个小小的流程图,来指导问题的解决,那么这里是一个很简单的。
That's certainly one way to do it, but for computers that's not necessarily the easiest way. So another way of solving it is to do something we already saw last time, which is basically, why not simply enumerate all possible examples and check them?
将一个等式代入另一个等式,这当然是一种办法,但是对电脑来说这绝对不是一件简单的事,所以解决这个问题的办法,正如我们上一次看过的,非常基本?
That's an important observation, and as we get to the part of the course we talk about computational complexity, you'll see that what we really care about is not how efficient the program is on easy problems but how efficient it is on hard problems.
我们已经学习了这门课程的一部分了,我们要开始认识到,计算的复杂度这个概念,你会学习到我们在乎的并不是,算法在简单问题上的工作效率,而是解决复杂问题的效率。
Optimal sub structure.
简单一点的子问题的最优方案来解决问题。
Pardon? I could square x but maybe I should just do something pretty simple here. Suppose-- whoops.
对不起我没听清,我可以求x的平方,但是好像这里我做点简单的,改动就可以解决问题了。
应用推荐