It implies that this algorithm is calling itself again and again, and again, and on each time the size of the problem I'm trying to sort is being divided by what?
这就说明此算法会一次又一次地调用自己,每次我要排序的问题规模大小,会除以多少呢?
Every time I use it, I'm creating a new instance, that's a different thing inside of memory.
我每次调用它,我就新建了一个类,这在内存中是个不同的事情。
The standard library, that first line of code, it's not strictly necessary but any time you use a function, a tool that someone else wrote that lives in that so called library, you do need that include line as we'll see.
标准库函数--第一行代码,严格来说,不是每次都要写的,但是一旦你调用某个别人写,的函数,而这个函数又恰巧位于标准库里面,你就要像我们看到的这样,把它include进去。
And then I'll create this function, d1 this distribution d 1, which will, whenever I call it, give me a random, a uniformly selected value between minus and plus volatility.
然后我会创建这个函数,这个概率分布,每次我调用这个函数的时候,他会给我返回一个随机的,按照均匀分布,从正负浮动值之间选择的值。
So, certainly the CS50 Library designed to be dynamic and, in fact, any time you call get string, we are, in fact, ; allocating a chunk of RAM but it's not coming from the stack; it's actually coming from this portion of memory called the heap.
所以,Cs50库是动态设计的,实际上,每次你调用GetSting时,我们分配一块内存,但它不是来自栈;,而是来自于叫做堆的,内存的一部分。
I just doubled the indentation each time so you can see it. So each successive call, notice what's happening. The argument is getting reduced. And we're going another level in. When we get down to this point, we're calling it with just a string of length one.
因此每次成功调用注意它的过程,我们的命题不断简化,而且我们不断深入嵌套,当我们走到这一步的时候,我们就是在调用它处理,仅有一个元素的字符串了。
应用推荐