Therefore, for simple branching programs, the length of time, the complexity the code, is what we would call constant.
因此,对于简单的分支程序,运行的时间长度,算法的复杂度,也就是我们说的常数。
But that's also nice, it lets you see how the recursive thing is simply unwrapping but the complexity in terms of the amount of time it takes is going to be the same.
它让我们看到了,在复杂度依照时间总数来看,没有变化的情况下,递归是怎么一步步的展开的,我欠你一个糖,谢谢。
It turns out to be-- there's a fairly complicated balance between the time of flight and the range.
答案表明,在飞行时间与射程之间,有着一个相当复杂的平衡关系
It at least does corroborate the claim that merge sort N*log N as we argue intuitively is in fact, N log N in running time.
但这至少证实了归并排序,的时间复杂度为。
And like all the other topics we've talked about in this class, it's a complicated subject, about which one could spend a great deal of time.
和课堂中涉及的所有话题一样,这是个复杂的问题,需要很长时间才能搞清楚。
Well it's a complicated job, delicate job to manage the president's schedule.
这份工作很复杂,设计总统的时间表很精密。
It was probably the pivotal point of our friendship when he realized I had actually spent some hours thinking about him and his troubles and he was trying to place that in his tremendously involved and tormented mental categories.
这或许是我们之间友谊的关键时刻,他知道我的确用了许多时间考虑他和他的困境,在他陷入极其复杂的痛苦的精神危机时,他更是急于想了解这一点。
But then also a little bit about your history, where you come from, some of your experiences which have helped you or informed your opinions on this very difficult issue that the entire world really is spending a lot of time trying to work on.
然后再谈谈你们各自的经历,你们从何而来,谈一些你们自己的经历,一些帮助过你们,或形成了你们,就这个复杂问题的观点,这个全世界都在投入大量时间试图解决的问题。
All right? It's now something that I can search in constant time. And that's what's going to allow me to keep this thing as being log.
在固定的时间内搜索,这样就可以让时间复杂度保持在对数级,好的,考虑过了这些。
The message I'm trying to get to here, because I'm running you right up against time, is I have to be careful about what's a primitive step.
我想说的事情是,因为我正在跟大家讲算法时间复杂度,我们需要注意一个基本步骤的定义,如果我可以假设。
I ask you for the running time of this algorithm and you give me the running time in terms of the running time, right.
我需要得到此算法的时间复杂度,那就明确地给出其,运行时间。
That is another way of saying that looking up this thing here is constant.
都是常数级的复杂度,另一种说法就是在这里查找时间是固定的。
And so, I get some power. I get the ability to store arbitrary things, but what just happened to my complexity?
但是复杂度变了,找到第k个元素,要花多少时间呢?
And so we might need to work out various, more complicated, formulas here, where we multiply the pain times its duration and take into account its intensity, get the sheer quantity of pain that way.
我们需要编制出各种,更复杂的公式,以便增加痛苦的倍数,延续时间,还要考虑痛苦的强度,获得痛苦的纯量。
I'm not wasting time typing out arguments and implementing more complicated function.
我不会在浪费时间在打印输出参数上,我执行了更复杂的程序。
I just go down the list selecting the smallest person at a time and then I repeat, repeat, repeat but when we actually did out the math or kind of reason through it, the running time, the asymptotic running time of bub-- of Selection Sort was also what?
只需要遍历列表,每次找出最小的元素,然后重复上述步骤,但从数学角度看,选择排序的时间复杂度,又是多少呢?
You can actually say big O of 1, big O of 1 being constant time, the same number of steps.
其复杂度为O,表示时间是一个常量,所用的步数是相同的。
N log N is not nearly as good as log N. As a sanity check, what algorithm have we seen that runs in log N time?
而N,log,N和log,N并不一样,我们之前探讨过的哪个算法其时间复杂度是log,N呢?
But that merging process only takes N steps, N*log N so that's N times log of N. Now, it's a little tricky to reason through this perhaps the first time, let's just take a very simple example and see if we can do a little sanity check here.
但这个合并过程只需要N步,所以时间复杂度是,第一次对此进行推论可能会有点儿棘手,我们举一个简单的例子,看看我们能否做一些完整性的检查。
Now, it's also the case that this is fundamentally what class this algorithm falls into, it is going to take exponential amount of time.
哪个种类的一个实例,这个问题的时间复杂度是指数级的,也就是当n上升的时候。
Once I have it sorted I can search it in log n time, but that's still isn't as good as just doing n. And this led to this idea of amortization, which is I need to not only factor in the cost, but how am I going to use it?
一旦对其完成排序,就可以在log,n的时间内对其完成搜索,但是这样做仍然不如n的复杂度,这样做引出了耗时分摊的想法,这时不仅需要考虑耗时的因素?
应用推荐