首页 > 其他 > 详细

Princeton-Algorithms-Part1-Week1-AnalysisOfAlgorithms

时间:2017-12-30 10:29:20      阅读:205      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!