[Algorithm] Asymptotic Growth Rate
f(n) 的形式 vs 判定形势
但,此题型过于简单,一般不出现在考题中。
Extended:


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))
关键点: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.

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的更多相关文章
- 本人AI知识体系导航 - AI menu
Relevant Readable Links Name Interesting topic Comment Edwin Chen 非参贝叶斯 徐亦达老板 Dirichlet Process 学习 ...
- The Go Programming Language. Notes.
Contents Tutorial Hello, World Command-Line Arguments Finding Duplicate Lines A Web Server Loose End ...
- Exercises for IN1900
Exercises for IN1900October 14, 2019PrefaceThis document contains a number of programming exercises ...
- Caching Best Practices--reference
reference:http://java.dzone.com/articles/caching-best-practices There is an irresistible attraction ...
- WPF依赖对象(DependencyObject) 实现源码,理解WPF原理必读
/// DependencyObject encompasses all property engine services. It's primary function /// is providin ...
- Background removal with deep learning
[原文链接] Background removal with deep learning This post describes our work and research on the gree ...
- (转)Awesome PyTorch List
Awesome-Pytorch-list 2018-08-10 09:25:16 This blog is copied from: https://github.com/Epsilon-Lee/Aw ...
- Ethereum White Paper
https://github.com/ethereum/wiki/wiki/White-Paper White Paper EditNew Page James Ray edited this pag ...
- CSUOJ 2031 Barareh on Fire
Description The Barareh village is on fire due to the attack of the virtual enemy. Several places ar ...
随机推荐
- 喵哈哈村的魔法考试 Round #12 (Div.2) 题解
A 注意答案会超过int,考虑分l,r奇数和偶数来考虑即可. #include<bits/stdc++.h> using namespace std; long long l,r; int ...
- windows 下重置 mysql 的 root 密码
今天发现 WordPress 连接不上数据库,登录 window server 服务器查看,所有服务均运行正常. 使用 root 账号登录 mysql 数据库,结果提示密码不匹配.我突然意识到,服务器 ...
- 写一个针对IQueryable<T>的扩展方法支持动态排序
所谓的动态排序是指支持任意字段.任意升序降序的排序.我们希望在客户端按如下格式写: localhost:8000/api/items?sort=titlelocalhost:8000/api/item ...
- c# 以换行(\r\n)拆分字符串
c# 以换行(\r\n)拆分字符串 字符串数组形式: string[] striparr = strip.Split(new string[] { "\r\n" }, String ...
- windows Server 2008 R2 IE增强安全配置正在阻止来自下列网站的内容
1.在windows Server 2008 R2上访问百度,会出现以下界面 当在Windows Sever 2008 R2中运动IE8的时候会发现默认情况下IE启用了增强的安全配置,为了方便而且是在 ...
- boost.property_tree解析xml的帮助类以及中文解析问题的解决(转)
boost.property_tree可以用来解析xml和json文件,我主要用它来解析xml文件,它内部封装了号称最快的xml解析器rapid_xml,其解析效率还是很好的.但是在使用过程中却发现各 ...
- 【NLP】Python实例:基于文本相似度对申报项目进行查重设计
Python实例:申报项目查重系统设计与实现 作者:白宁超 2017年5月18日17:51:37 摘要:关于查重系统很多人并不陌生,无论本科还是硕博毕业都不可避免涉及论文查重问题,这也对学术不正之风起 ...
- Mongodb查询命令详解
前面我们简单的讲了下find方法,下面来深入的过一下它的用法以及常用的字方法. 下面是mongo中db.user.help()中对find方法的定义和解释: db.user.find([query], ...
- sqlserver修改主键为自增
使用PowerDesigner创建一张表, 拷贝建表语句发现ID不是自增的, 以下是修改语句: ALTER TABLE USER_JOB_EXE_REC DROP COLUMN id; , ); 注: ...
- 带参数的sigmoid
$y=\frac{1}{1+e^{-(\alpha\times x+\beta)}}$ alpha越大,曲线越陡峭,beta控制平移 import numpy as np import pylab a ...



