【发布时间】:2021-06-16 20:52:29
【问题描述】:
将以下代表运行时间的函数从小到大排列(根据 相对于 n) 的增长率并将那些在同一等价类中的函数分组
函数列表
2n^3+12n^2+5,
8(log n)^2,
1.5^n,
n^4-12n^3,
4n^3(log n),
4n^3,
n!,
7n+6
My solution in ascending order is :
8(log n)^2 - logarithmic complexity
7n+6 - linear complexity
2n^3+12n^2+5, 4n^3(log n), 4n^3 - polynomial complexity
n^4-12n^3 - polynomial complexity
1.5^n - Factorial complexity
n! - Exponential complexity
不确定我所做的是否正确。任何反馈将不胜感激。
【问题讨论】:
-
为什么说
4n^3(log n)等价于4n^3?你试过证明吗? -
我不太确定。我认为 4n^3(log n) 可能具有更高的复杂性。不,我没有试图证明。
-
那么,我想你应该试试。这是一个数学问题,每个答案都应该可以用数学方法证明。如果你不能证明你的推理是正确的,那么你就没有完成。
标签: algorithm function time-complexity discrete-mathematics