So, let's think about it, and let's think about what we're actually doing when we solve this.
确实更有效率的解决了问题,好,接下来让我们来想想,看我们实际上是怎么来解决这种问题的。
Like, if there is a problem, I try to think of the solution.
比如说出了什么问题,我就试着想怎么解决。
OK, and you can see that this thing ought to unwrap, it's going to keep extending out those multiplications until gets down to the base case, going to collapse them all together.
好,你可以看到这种方法,是怎么解决的,他一层层的将乘法展开一直到最底层,然后将他们一起乘起来。
So there are formal questions that we will take up time and again.
人们又怎么对待那些资源,这些是我们需要花时间,解决的正式问题。
So how did you settle disputes when they fight and disagree, say, Executive Secretary Rumesfeld, who is a fellow Princetonian both went to Princeton, but he wouldn't be the easiest person to deal with.
在他们争论和出现分歧的时候,你是怎么解决的呢,比如说行政秘书拉姆斯菲尔德长吧,你们俩是普林斯顿的校友,但是他在工作中并非很好对付的人。
So now we're left with a problem that's but 500 pages large and so what might a human do now to find Mike even more closely?
现在我们只用翻500页就能解决问题了,接下来,怎么做才能离Mike这个名字更近一步?
How can I solve this problem?
我该怎么解决这个问题呢?
What does it require to be a successful mechanic, to do all the mechanics problems?
怎么才能当个成功的力学家,并能解决所有的力学问题呢
there's a puzzle as to how are we even to understand this case?
就有这样一个疑团要解决,我们怎么理解这种案例?
What remedies do we see?
我们怎么解决这个问题
How that works out?
他怎么解决的?
And we hope that at the end of the class, every time you're confronted with some technical problem, one of your first instincts is going to be, "How do I write the piece of code that's going to help me solve that?"
并且我们希望到了期末,每当你要面对一些,技术问题的时候,你们的本能之一将会是:,“我怎么才能编写一个代码,来帮我解决这问题?“
What we really want to worry about is, as the size of the problem gets larger, how does this thing grow? How does the cost go up?
随着问题规模的变大,解决问题花费的代价是怎么增长的,因此我们将会主要地讲讲?
Not so easy to see. All right, but this is actually a great one of those educational moments. This is a great example to think recursively. If I wanted to think about this problem recursively- what do I mean by thinking recursively?
看不太出来,好,但实际上是一个有教育意义的时刻,这是一个很好的关于递归的例子,如果我用递归的思想,去考虑这个问题-,我该怎么用递归去解决这个问题呢?
OK. So that then leads to the question about what should we do about this?
那我们应该怎么去,解决这个问题呢?
All right this is kind of the Microsoft Excel problem from hell here right?
这种问题,怎么也应该用Excel表格来解决,对不对?
Where is the ingenuity there and how can we leverage that in our own problem solving?
那么其独创性在哪里?,我们在解决实际问题时该怎么去利用它?
All right. So it's fun, and I got a little bit of applause out of it, which is always nice for me, but I also showed you how to think about it recursively.
好,挺有趣的,我也得到了一点掌声,这让我挺高兴的,但是我想让大家明白,怎么用迭代的思想来解决这个问题。
Just to think about how I would break that problem up.
然后想想该怎么,解决这个问题。
And then remember how you solve this 'cause otherwise completely useless exercise.
记住我是怎么解决这个问题的,否则就是一次,无意义的演练了,对吧。
So what can we do to solve this?
来解决这个问题,我们能怎么做?
So you can actually say, how do I know which methods are associated with the class? For that, we can call dir. And what it does, is it gives me back a listing of all the things, dir all the methods, that are associated with it.
我们开始建立类了,我们得到了这些方法,因此实际上你可以说,我怎么知道,哪些方法是关联与这些类的?,为了解决这个问题,我们可以调用,这个方法的作用。
I'm given an integer that's a perfect square, and I want to write a little piece of code that's going to find the square root of it. All right so I'm cheating a little, I know it's a perfect square, somebody's given it to me, we'll come back in a second to generalizing it, so what would the steps be that I'd use to walk through it?
完美平方数的整数,我想写一段代码来求这个数的平方根,好,我这儿有点儿作弊了,我知道这是一个完美的平方数了,他们给我的,我们后面会讲怎么产生这个数的,那么我想解决这个问题,需要什么步骤呢?
So how would we go about solving this problem if I told you not only was there a maximum weight, but there was a maximum volume. Well, we want to go back and attack it exactly the way we attacked it the first time, which was write some mathematical formulas.
有些时候两个都重要,所以如果我告诉你这里不仅有,最大重量还有最大容量,我们应该怎么解决这个问题呢?,好了,我们想回过来然后,和第一次一样看看这个问题。
The real issue is to figure out how to build constructs out of this that tackle particular problems, but the fundamental basics of computation are just captured in that set of mechanisms.
坏消息是当然这不是真的,真正的问题是怎么来,构建解决特定的问题的这些结构,但是运算的最基本的东西,仅仅体现在机制集里。
If someone could figure out how to turn off messages, that would be great .
如果谁可以解决怎么关掉消息,那将会非常不错的【笑声】
So it's a short problem set, but make sure you know how to do those problems.
因此这是个小问题集,但是确保你懂怎么解决这些问题。
Well, it's, you sort of know how you'd do it if this was grammar school right?
你怎么解决这个问题呢?,很简单?
Undefined reference, what was the solution last time?
未定义的引用,上次我们是怎么解决的呢?
How do we solve this problem?
我们要怎么解决这个问题呢
应用推荐