Or take this value out of memory, run it through some other simple operation, stick it back in memory.
或者从记忆存储器中取出一个结果,在类似的操作中运行,再插回到存储器中。
In other words it doesn't just return when it finds one, it's going to run through all of them. All right?
但是它将会继续运行,换句话来说当它找到一个结果时,它不会立刻返回结果它会先遍历所有的内容?
The mind reflects the workings of the brain just like computation reflects the working of a computer.
心理反映了大脑的活动,就像运算结果反映了计算机的运行一样
One in the so called hundreds columns, a two in the so called tens column 2 so that's 10 times 1 plus 10 times 2 is 120, 123 plus 3 times 1, 123 alright, so completely uninteresting, if this is something long familiar to you, but it turns out computers work in exactly the same way.
这里的1处于百位,2处于十位,所以100乘以1加上10乘以,再加上1乘以3,好的,完全正确就是,但是毫无趣味,这对你是一件极其熟悉的事,但是电脑结果也是以同样的方式运行的。
Notice one last piece. If I'm going to do that, run through all possible answers, I still want to know, gee, what if there aren't any answers? How do I return that case?
注意最后一段,如果我要这样做,也就是运行所有可能的答案,我还是想知道要是没有结果呢?,在这个例子中应该返回什么呢?
And those instructions, by the way, are very simple: they're things like, take the value out of two places in memory, and run them through the multiplier in here, a little piece of circuitry, and stick them back into someplace in memory.
顺便说一句,那些指令非常简单:,他们从记忆存储器中,取出两个位置的结果,在倍增器中运行,一小部分电路,再将它们插回存储器中的某些地方去。
Well, you could just try it and see if it works, right? That's what testing is all about.
你可以仅仅的去试试运行程序,然后看看结果对不对?这就是测试的内容。
- These ones should curl, see if I can - oh, not bad. Let's run it.
这些东西可以卷上去,让我们看看,结果不错,让我们来运行一下程序。
OK, what I would like you to see is I've been printing out, as I went along, actually let's back up slightly and look at the code. There's merge sort.
好的,我想让你们看就是我运行过后,打印出来的结果,我们再回头看一下这段代码,这就是归并排序,输入一个列表。
When I ran it up here, with the old Fib, and we printed the result, and I ran it with Fib 1 down here.
当我运行到这里,也就是老的Fib函数,我们打印这个结果,当我在下面调用Fib1时,也打印了结果。
And I've put it in my debugging code.
调试的代码中去,然后运行看看结果。
What happens if I run this sucker?
我运行下这个糟糕的东西会有什么结果?
so let's run this and see what happens.
让我们试试运行程序看看结果。
So I tried running a program in this little black and white window called GCC and we'll see it today working properly that is a so called compiler.
在一个名为GCC的黑色小窗口里,运行我们的程序,然后得出想要的结果,这就是所谓的编译器。
I'm going to go over here, and let me define a couple of these things.
仅仅是用来显示值的,好,让我们看看如果,我运行这个程序会有什么结果。
So you can imagine that this is a very powerful mechanism. So let's look what happens when I run-- start to run this.
因此你可以想到这是一种很强大的机制,让我们看看让我开始运行,这个程序的时候会有什么结果。
And we must know what the result is supposed to be. Typically when you run an experiment, you say, and I think the answer will be x.
这样我们可以来查看代码的进程,我们还必须清楚结果应该是怎么样的,比如当你运行一个实验的时候。
Rock it if you like to try and see where it goes.
如果你愿意尝试看看它的运行结果的话。
But that little short hand there is doing exactly the same thing. It is adding that value into some digits and putting it back or signing it back into some digits. And I'll walk through that loop and when I'm done I can print out the total thing does. And if I do that, I get out what I would expect.
加上得到的这个数的,但是这个缩写声明其实是进行了同样的操作,它把我们得到的这个数加到一个数上面去,然后用和对这个数进行了重新赋值,在循环中会去遍历字符串,当完成循环后,程序会显示数字的总和,如果我运行,这个程序的话,我会得到我期待的结果。
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.
这是一个我们接下来要去,尝试和解决的问题,如果我们能做到的话会很不错,因为首先,它解决了结果可能和我,运行的计算机有关系的问题,因为这从根本了告诉了,我们这个问题的复杂度,第二件事情,就是这种方法可以依据输入的大小来计算,而这正是我最担心的地方。
应用推荐