【发布时间】:2014-10-28 15:36:34
【问题描述】:
您好,我已经开始学习算法分析了。在这里,我对渐近分析有疑问。 假设我有一个函数 f(n) = 5n^3 + 2n^2 + 23。 现在我需要为上述函数找到 Big-Oh、Big-Omega 和 Theta 符号,
Big-Oh:
f(n) <= (5 + 2 + 23) n^3 // raising all the n's to the power of 3 will give us a value which will be always greater than f(n)
f(n) <= 30n^3
f(n) belongs to Big-Oh(n^3)
Big-Omega:
n^3 <= f(n)
f(n) belongs to Big-Omega(n^3)
Theta:
n^3 <= f(n) <= 30 n^3
f(n) belongs to Theta ( n^3)
So here,
f(n) belongs to Big-Oh(n^3)
f(n) belongs to Big-Omega(n^3)
f(n) belongs to Theta(n^3)
对于任何多项式,就像这样,Oh、Omega 和 Theta 表示法的增长顺序是相同的(在我们的例子中是 n^3 的顺序)。 当所有符号的增长顺序都相同时,那么用不同的符号显示它们有什么用以及确切的位置 可以用吗?如果可能的话,请给我一个实际的例子。
【问题讨论】:
标签: algorithm data-structures computer-science asymptotic-complexity