【发布时间】:2015-05-20 21:11:41
【问题描述】:
我希望找到以下复杂度函数的大 O 表示法:f(n) = n^(1/4)。
我想出了几个可能的答案。
- 更准确的答案似乎是
O(n^1/4)。但是,由于它包含一个根,它不是一个多项式,而且我从未在任何教科书或在线资源中看到这个 n'th 根n。 - 使用数学定义,我可以尝试定义具有指定
n限制的上限函数。我尝试用log2 n蓝色和n绿色绘制n^(1/4)红色。
log2 n 曲线与n^(1/4) 相交于n=2.361,而n 与n^(1/4) 相交于n=1。
鉴于正式的数学定义,我们可以提出两个具有不同限制的附加大 O 符号。
以下显示O(n) 适用于n > 1。
f(n) is O(g(n))
Find c and n0 so that
n^(1/4) ≤ cn
where c > 0 and n ≥ n0
C = 1 and n0 = 1
f(n) is O(n) for n > 1
这表明O(log2 n) 适用于n > 3。
f(n) is O(g(n))
Find c and n0 so that
n^(1/4) ≤ clog2 n
where c > 0 and n ≥ n0
C = 1 and n0 = 3
f(n) is O(log2 n) for n > 3
通常会使用哪个大 O 描述复杂性函数? 3个都是“正确的”吗?这取决于解释吗?
【问题讨论】:
-
n^(1/4)不是O(log n)。当n=2^16时,它们再次相交。
标签: algorithm math big-o time-complexity complexity-theory