So I'm going to solve this by enumerate and check, which is an example of what's called a brute-force algorithm.
你懂的,所以我得靠列举和检验来解决这个问题,这就是我们说的穷举算法。
and I enjoy, like, solving proofs or, like, solving problems, but it's only one part of like, what I do, like as a person.
做证明题或者解决问题对我来说是一种享受,但这只是我生活的一部分而已。
So I haven't done magic, I've given you a really fast way to solve a knapsack problem, but it's still exponential deep down in its heart, in something.
所以我并没有施魔法,我已经告诉了你,一种快速解决背包问题的方法了,但是某些方面它的核心仍然是指数增长的。
All right. So you solve the problem and then, lo and behold, it turns out that: It is my friend Bumpy. Bumpy gives me a push.
好了,你们解决这个问题,然后,你瞧,结果竟是:,这是我的朋友,颠簸,颠簸推了我一把。
And the prospect of having a lot of time to pursue math problems of a richer and deeper sort seems fairly attractive.
要是能有时间,解决更困难更深奥的数学问题,对我相当有引吸力。
And, by the way, this business on working on every problem is important because I have seen some people who start working on number one, but that is not their strong suit.
另外,解决每个问题的事情,是很重要的,因为我看到一些人,从第一个开始工作,但这不是他们的强项。
I went to see a rich girl I knew. In the morning she pulled a hundred-dollar bill out of her silk stocking and said, "You've been talking of a trip to Frisco. That being the case, take this and go have your fun." So all of my problems were solved.
我去看望我以前认识的一位有钱的姑娘,到了早上,她从丝绸钱袋里取出一张100元的支票说:,“既然你那么向往到圣弗兰西斯科的旅行,拿着这个去寻找你的快乐吧“,这下我的问题全部解决了。
But can I borrow that idea of taking a problem and dividing it into something smaller.
但是我可以借鉴解决这个问题的思想并将其划分为,更小的问题。
So that's the topic that I'd like to address today.
这就是我今天要解决的问题。
Until that's resolved, I don't think we can never be comfortable.
在这个问题解决之前,我想我们不会安心的。
I wanted to mention in this context, because I'm emphasizing how banks help solve the adverse selection and moral hazard problem -I wanted to mention briefly here also the rating agencies, which fulfill some of these functions.
我早就想在这段内容里讲讲这事了,因为我一直强调,银行是如何帮助解决逆向选择,以及道德风险问题的...,我还一直想在这里简要的提下,本应履行这些职能的那些信用评级机构
The problem it solves for the cell is how to do I make a barrier around myself to define what's in me and what's outside of me when most of what's around me and what's in me is water.
它为细胞解决的问题是,当我体外和体内大部分都是水情况下,我怎样在自己周围设置一个界线,来区分什么是体内的,什么是体外的
Now, I want to do one concrete problem where you will see how to use these derivatives.
现在我要解决一个具体的问题,从中你会明白如何运用这些导数
OK. I know. It looks boring. But it's a structure of the things I want to think about when I go through trying to take a problem and mapping it into a iterative program.
好,我知道这看起来有点无聊,但是这是我要去以迭代的方式,去解决一个问题采取的,措施的大致结构。
We first have to get about the more general question what is it for me to survive period.
我们首先要解决更综合的问题,我阶段性不死意味着什么。
Because if b was odd, then b minus one is even which means on the next step, I can cut the problem in half again.
这意味着我在下一步里解决的问题,规模要小了一半,好,课堂材料的第三题。
There's a tendency for people to say, oh this problem's exponential, I can't solve it.
人们往往会说,哦这是个指数型的问题我没法解决它。
Well, I solve 2 or 3 exponential problems before breakfast every day. You know things like, how to find my way to the bathroom is inherently exponential, but I manage to solve it anyway.
你要知道如何找到,我的浴室就是一个,固有的指数型问题,但是我还是能解决它。
I'm going to have it take in as input how many legs I got, how many heads do I have, and I just want to write a little loop.
这就是解决问题的思路,我将要输入我有多少条腿,以及我有多少只头。
This is the first full paragraph: I don't know how to cure the sourcitis, except to tell you that I can discover a good many possible sources myself for Wise Blood, but I am often embarrassed to find that I read the sources after I had written the book.
这是第一段的全文:,“我不知道如何解决资料来源的问题,只能告诉你,我自己发现了很多《慧血》的材料来源,但我经常觉得很难堪,因为我在完成了那本书后才读的资料。
That's the question we're going to try and address. If we can do this, this is good, because first of all, it removes any questions about what machine I'm running on, it's talking about fundamentally, how hard is this problem, and the second thing is, it is going to do it specifically in terms of the input. Which is one of the things that I was worried about.
这是一个我们接下来要去,尝试和解决的问题,如果我们能做到的话会很不错,因为首先,它解决了结果可能和我,运行的计算机有关系的问题,因为这从根本了告诉了,我们这个问题的复杂度,第二件事情,就是这种方法可以依据输入的大小来计算,而这正是我最担心的地方。
So I propose this as a new algorithm for sorting N elements and being 8 in this case or really a thousand in the case of the phonebook, or anything of larger size.
所以我提出一种新的算法,来解决N个元素的排序问题,在这个问题中N是8,在电话簿的问题中N是一千,或者是大规模的任何问题。
Right, so the things we want you to take away from this are, get into the habit of using pseudo code when you sit down to start a problem, write out what are the steps.
好,这儿我想大家明白的就是,养成解决问题时先写伪代码的好习惯,把步骤都写出来,我想要告诉你们的是一个好的程序员。
If I want to try and decide how to tackle a problem in an iterative matter, here the steps I'm going to go through. First thing I'm going to do, is I'm going to choose a variable that's going to count.
但是这就是我对它的观点,如果我试着去以迭代的方式,解决一个问题的话,下面是我应该采取的步骤,第一件要做的事情。
But in order to address that particular question what is for me to survive the death of my body is that even a posibility or not.
但为了解决这个问题,我的肉体不死意味着什么,是否有这样的可能性。
You say, "Yeah, here's a math problem I haven't solved before, but so what? I've just done so much math, " it holds no appeal to me before."
你会说“是的,我没解决过这个数学问题,那又怎样?我研究了太久的数学,我对它失去了兴感“
Pardon? I could square x but maybe I should just do something pretty simple here. Suppose-- whoops.
对不起我没听清,我可以求x的平方,但是好像这里我做点简单的,改动就可以解决问题了。
If we weren't so pressed for time, I kinda wanna see how long we could get away with this before it gets awkward, but that, in fact, is an infinite loop t hat's hopefully deliberate.
如果有时间,我想看看,我们需要花多长时间解决这一问题,事实上,它是我故意,使用的无穷循环。
Again, same kind of reasoning says, given some value x, I happened to pick a small one here, what's an easy way to do this? Well, let's just start at one. That's my variable I'm going to change and check.
好,尤其是,让我们到这里来,让我给大家看看第二个例子,让我把这个注释掉,这是我要解决的,第二个问题,假设我想找到一些整数的,所有除数,我想要找出来这个数的所有的除数。
应用推荐