algorithm - 增长率递增顺序

标签 algorithm computer-science

Arrange the following functions in increasing order of growth rate (with g(n) following f(n) in your list if and only if f(n)=O(g(n))).

a)2^log(n)  
b)2^2log(n)  
c)n^5/2  
d)2^n^2  
e)n^2 log(n) 

所以我认为答案是递增的顺序是 CEDAB
这是对的吗?我对选项A和B感到困惑。 我认为选项 A 应该排在第一位。我的意思是少一个所以请帮助解决这个问题。 我在算法类(class)第 1 部分作业 (Coursera) 中遇到的这个问题。

最佳答案

首先,n 的任何正幂总是大于log n,所以 E 先于 C ,不是之后。

此外,D 出现在所有其他函数之后,作为 2^n^2 的解释(可以是 2^(n^2)( 2^n)^2 = 2^(2n); 忽略 BIDMAS 可能是错误的...) 是 n 本身的指数。

log为基础a,一些任意常量:

a) enter image description here

b) enter image description here

因此,不幸的是,实际顺序取决于 a 的值,例如如果

的值

enter image description here

大于2,则A在E之后,否则在E之前。奇怪的是,E 中对数项的基数是无关紧要的(它仍然保持原位)。

关于algorithm - 增长率递增顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38418580/

相关文章:

algorithm - Big O Notation 的长度是用什么来衡量的?

algorithm - 面试街头挑战中的错误答案

algorithm - 更新图时保持最短路径

python - 合并三个排序列表的递归 Python 程序

python - 树或图收缩

c++ - 图论 - 从顶点 A 开始,沿两个方向遍历所有路径,以最短路线再次到达 A

algorithm - 滑动窗口算法实现

c - 代码的表示(C)

algorithm - 最大流量寻找最有利可图的安排

arrays - 访问元素——真的是 O(1) 吗?