On May fifteenth, just seventeen days after leaving New York, Captain Creesy wrote this in the Flying Cloud's log: "We have passed the Equator in two days less time than ever before.
VOA: special.2009.12.23
In the log case, it's divide by an amount.
而在对数算法中。
Cut the problem in half. Cut the problem in half again. And that's a typical characterization of a log algorithm.
是每次除以特定的量,将问题减一半,再减一半,如此,这就是对数算法的典型特性。
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.
但这至少证实了归并排序,的时间复杂度为。
Now hopefully you're keeping a sheet of paper with you and you're writing down what you eat so you don't forget everything, and then you sit down at your computer at the end of the day and you log it all in.
希望你们可以随时带张纸,以便随时记下,吃的东西以防忘记,然后坐在电脑前,在一天结束时输入电脑
It's an example of a very common tool that's going to be really useful to us, not just for doing search, but for doing a whole range of problems. That is, in essence, the template the describes a log style algorithm.
不仅仅是做搜索,还可以解决一整类问题,本质上,这个模板就描述了,对数形的算法,我们一会再回来。
Right? If that was the case in that code, then my complexity is no longer log, because I need linear access for each time I've got to go to the list, and it's going to Lisp be much worse than that.
这里的复杂度不再是对数的了,因为每次在列表中,查找需要线性访问,可能还要糟糕,其实,有些编程语言,如。
Yeah. Log. It's a good think, but why do you think it's log? Ah-ha. It's not a bad instinct, the length is getting shorter each time, but what's one of the characteristics of a log algorithm? It drops in half each time.
对了,对数,这是个好想法,但是你们为什么认为是对数呢?,啊哈,这样的本能不错,每次长度都会缩小些,但是对数算法的特性是什么。
Log n Log n, because at each stage I'm cutting the problem in half. So I start off with n then it's n n/2 n/4 n/8 over two n over four n over eight.
因为总共有多少层?,因为在每一层,我都是把问题分解成两半,因此以n开始,然后是。
And if you ask the TAs in recitation tomorrow, they'll tell you that you see a lot of n log n algorithms in computer science.
如果你明天在复习课上问助教的话,他们会告诉你在计算机科学中,存在着非常多的n,log,n规模的算法。
应用推荐