So when I do the analysis, I want to think about what am I doing here, am I capturing all the pieces of it? Here, the two variables that matter are what's the length of the list, and how many times I'm going to search it?
这里,要关注的,两个变量是列表,的长度以及我要搜索的次数,这种情况下,这个算法赢了?
But for the most part, I mean, I've seen... I don't know how many times I've seen paparazzi almost get hit by cars.
但是大部分情况下,我是说,我见过……我都忘了多少次我看到狗仔队差点被车撞上。
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?
每次能丢掉一半,所以这里不是-,好的,但你也很接近了,他可能是线性的,但我得遍历多少次呢?
So if I start off with a list of length n, how many times can I divide it by 2, until I get to something no more than two left?
我能够除以多少次2呢?,直到我得到的长度不超过2么?,对数次,对吧?就像刚才那位同学说的那样?
How many times do I go through the loop?
那我执行了多少次循环呢?
Sorry? OK. You're doing the whole thing for me What's the complexity just of this inner loop m How many times do I go through that loop?
就这一块代码的,我执行了多少次这个循环?,次对不对?,here?,Just,this,piece。,我一会儿就会去得到你的答案的?
And I'll remind you, what I'm printing out there is first and last, with the range I'm looking over, and then just how many times the iteration called.
我要打印出来的是,每次的区间,也就是first和last指向的值,以及重复多少次了。
How many times do I go through that loop?
我都要去做m个操作?
应用推荐