码迷,mamicode.com
首页 > 其他好文 > 详细

Princeton-Algorithms-Part1-Week1-AnalysisOfAlgorithms

时间:2017-12-30 12:19:07      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:分享   inf   art   fun   put   show   input   plot   const   

Slides from Princeton Algorithms.

技术分享图片

If you do it as a lg, lg plot very often you‘ll get a straight line. And the slope of the straight line is the key to what‘s going on. In this case, the slope of the straight line is three and so you can run what‘s called a regression to fit a late, the straight line through the data points. And then, it‘s not difficult to show to do the math to show that if you get a straight line and the slope is B, then your function is proportional to A, N^B. That‘s called the power law.

技术分享图片

If there is a power law, and again in a very great majority of computer algorithm running times is going to be a power law. What we can do is just double the size of the input each time the way we were and take the ratio of the running times for N and 2N. And if you do that, that ratio going to converge to a constant. And in fact the log of the ratio is going to converge to that constant, which is the exponent of N (B).

技术分享图片

 技术分享图片

 

Princeton-Algorithms-Part1-Week1-AnalysisOfAlgorithms

标签:分享   inf   art   fun   put   show   input   plot   const   

原文地址:https://www.cnblogs.com/Kaneki-Ken/p/8148680.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!