Once each time. Right? I only do one swap potentially, it-- though not one potentially, each time at the end of the loop I do a swap.
每次循环做一次,对么?我其实,就可能做了一次交换,也许并不是可能,每次循环的结束我都得做一次交换。
So this isn't-- OK. And you're also close. It's going to be linear but how many times do I go through this?
每次能丢掉一半,所以这里不是-,好的,但你也很接近了,他可能是线性的,但我得遍历多少次呢?
What second millennium Hebrews and early first millennium Israelites or Judeans, Judahites, actually believed or did is not always retrievable, in fact probably not retrievable, to us. We have some clues.
西元前2000年的希伯来人和前1000年早期的以色列人,或者说犹太人,犹太民族所信仰的和所做的,不是每次,都能复原,事实上可能无法复原,我们掌握了一些线索。
And in each election, they would come forward and say, "we are not really a left wing party, we're a centrist party these days" And people would say, we don't believe you.
每次选举的时候,他们都会声称,我们不是一个左翼政党,我们现在是中间派,但是选民都不相信他们
> So now that might not have felt like the fastest algorithm but think about what you could have done with that algorithm in each iteration, much like the phonebook up front here, you literally split that problem in two because on each iteration roughly half of you were sitting down and then another half and then another half.
虽然这并不是最快的算法,但如果把这种算法每次迭代,就像刚才查电话簿一样,你便将这个问题一分为二了,因为每一次迭代后只有一半坐下来,以此类推。
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进去。
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时,我们分配一块内存,但它不是来自栈;,而是来自于叫做堆的,内存的一部分。
应用推荐