f(n) 的形式 vs 判定形势

但,此题型过于简单,一般不出现在考题中。

Extended:

link

Let's set n = 2^m, so m = log(n)

T(n) = 2*T(n^(1/2)) + 1 =>

T(2^m) = 2*T(2^(m/2)) + 1 =>

S(M) = 2*S(M/2)) + 1

通过变量替换,变为了熟悉的、主定理能解决的 形式 => S(m) ~ O(m)

故,S(m) = T(log(n)) ~ O(log(n))

link

关键点:match 主定理(3)的条件。

a*f(n/b) <= c*f(n)  ->

3*f(n/4) <= c*f(n)  ->

3*(n/4)*log(n/4) <= c*n*log(n)  ->

3/4 * n*log(n/4) <= c*n*log(n)

可见,有c<1时,是满足的。

答案就是O(nlogn)

When f(x) = x*sqrt(x+1)

这里的常数1是个tricky.

去掉它,x^(3/2)

变为x,sqrt(2)*[x^(3/2)]

可见,f(x)~Θ(x^(3/2))

T(n)=T(⌊n/2⌋)+T(⌊n/4⌋)+T(⌊n/8⌋)+n.

link

n+(7/8)*n+(7/8)^2 *n+(7/8)^3 *n+⋯ 等比数列!

so we have a geometric series and thus,

for our upper bound.

In a similar way, we could count just the contribution of the leftmost branches and conclude that T(n)≥2n.

Putting these together gives us the desired bound, T(n)=Θ(n)

Extended:

Recurrence Relation T(n)=T(n/8)+T(n/4)+lg(n)

太难:Solution.

(a) T(n) = T(n-1) + cn         link

(b) T(n) = T(n-1) + log(n)    link

(c) T(n) = T(n-1) + n^2      link

(d) T(n) = T(n-1) + 1/n       link

(a) 递归展开,探寻规律:

T(n)=T(n−3)+(n−2)c+(n−1)c+nc

At the end we use T(2)=T(1)+2c=1+2cT(2)=T(1)+2c=1+2c. We conclude that

T(n)=1+(2+3+⋯+n)c.

可见是O(n^2)

(b) 递归展开,探寻规律:

T(n) = T(n - 1) + log n

= T(n - 2) + log (n - 1) + log n

= T(n - 3) + log (n - 2) + log (n - 1) + log n

= ...

= T(0) + log 1 + log 2 + ... + log (n - 1) + log n

= T(0) + log n!

According to Stirling's formula, 可见是O(n*log(n))

(c) 递归展开,探寻规律:

T(n)=T(0)+1^2+2^2+3^2+⋯+n^2

Or simply,

O(n^3)

(d) 这里是个调和级数

This is the nth harmonic number, Hn = 1 + 1/2 + 1/3 + ... + 1/n.

"所有调和级数都是发散于无穷的。但是其拉马努金和存在,且为欧拉常数。"

In fact, Hn = ln(n) + γ + O(1/n)

Hint:比较难,需换两次元。

[Algorithm] Asymptotic Growth Rate的更多相关文章

  1. 本人AI知识体系导航 - AI menu

    Relevant Readable Links Name Interesting topic Comment Edwin Chen 非参贝叶斯   徐亦达老板 Dirichlet Process 学习 ...

  2. The Go Programming Language. Notes.

    Contents Tutorial Hello, World Command-Line Arguments Finding Duplicate Lines A Web Server Loose End ...

  3. Exercises for IN1900

    Exercises for IN1900October 14, 2019PrefaceThis document contains a number of programming exercises ...

  4. Caching Best Practices--reference

    reference:http://java.dzone.com/articles/caching-best-practices There is an irresistible attraction ...

  5. WPF依赖对象(DependencyObject) 实现源码,理解WPF原理必读

    /// DependencyObject encompasses all property engine services. It's primary function /// is providin ...

  6. Background removal with deep learning

    [原文链接] Background removal with deep learning   This post describes our work and research on the gree ...

  7. (转)Awesome PyTorch List

    Awesome-Pytorch-list 2018-08-10 09:25:16 This blog is copied from: https://github.com/Epsilon-Lee/Aw ...

  8. Ethereum White Paper

    https://github.com/ethereum/wiki/wiki/White-Paper White Paper EditNew Page James Ray edited this pag ...

  9. CSUOJ 2031 Barareh on Fire

    Description The Barareh village is on fire due to the attack of the virtual enemy. Several places ar ...

随机推荐

  1. 安装 jenkins

    1. 将jenkins.war包放在 tomcat  的 webapps 目录下即可 2 重启 tomcat 3. 通过浏览器访问 IP:8080/jenkins

  2. spring cloud:Edgware.RELEASE版本中zuul回退方法的变化

    Edgware.RELEASE以前的版本中,zuul网关中有一个ZuulFallbackProvider接口,代码如下: public interface ZuulFallbackProvider { ...

  3. C#中流的读写器BinaryReader、BinaryWriter,StreamReader、StreamWriter详解【转】

    https://blog.csdn.net/ymnl_gsh/article/details/80723050 C#的FileStream类提供了最原始的字节级上的文件读写功能,但我们习惯于对字符串操 ...

  4. he canvas has been tainted by cross-origin data and tainted canvases may not be exported

    来自: https://ourcodeworld.com/articles/read/182/the-canvas-has-been-tainted-by-cross-origin-data-and- ...

  5. IDA反汇编学习

    1 转自:http://www.cnblogs.com/vento/archive/2013/02/09/2909579.html IDA Pro是一款强大的反汇编软件,特有的IDA视图和交叉引用,可 ...

  6. android makefile文件批量拷贝文件的方法

    该方法是shell 和makefile组合使用 wallpapers := $(shell ls packages/apps/hyst_apps/NewBingoLauncher_C/default_ ...

  7. EasyUI tabs update 正确用法

    来源:http://ewoyaofei.blog.163.com/blog/static/343562612012617111734974/ 一直以为 tabs update 是 easyui 的 b ...

  8. DropDMG for Mac(dmg 文件打包工具)破解版安装

    1.软件简介    DropDMG 是 macOS 系统上的一款帮助用户快速打包 DMG 文件的 Mac 文件管理软件,DropDMG 不但可以将影像档加密.更可以配合 GZip .BZip2 .Ma ...

  9. rdlc报表在vs2008下编辑正常,在vs2012上编辑就报错

    最近我们的系统的开发工具由vs2008升级到了2012,由于系统中很多报表都是用rdlc来开发的,今天 遇到有报表需要改动的需求,就直接使用vs2012对rdlc报表进行了编辑,结果改完后,怎么预览报 ...

  10. [Aaronyang] 写给自己的WPF4.5 笔记10[层次数据需求处理,TreeView绿色文章1/4]

     我的文章一定要做到对读者负责,否则就是失败的文章  ---------   www.ayjs.net    aaronyang技术分享 AY留言: 文章根据难易,我根据游戏的规则进行了分色,希望读者 ...