【问题标题】:Big O notation for the complexity function of the fourth root of nn 的四次根的复杂度函数的大 O 表示法
【发布时间】:2015-05-20 21:11:41
【问题描述】:

我希望找到以下复杂度函数的大 O 表示法:f(n) = n^(1/4)

我想出了几个可能的答案。

  1. 更准确的答案似乎是O(n^1/4)。但是,由于它包含一个根,它不是一个多项式,而且我从未在任何教科书或在线资源中看到这个 n'th 根 n
  2. 使用数学定义,我可以尝试定义具有指定n 限制的上限函数。我尝试用log2 n 蓝色n 绿色绘制n^(1/4) 红色

log2 n 曲线与n^(1/4) 相交于n=2.361,而nn^(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


【解决方案1】:

对于任何值r>0,对于足够大的值nlog(n) < n^r

证明:

看看log(log(n))r*log(n)。对于足够大的值,第一个明显小于第二个。在大 O 符号术语中,我们可以明确地说r*log(n)) 不在O(log(log(n)) 中,而log(log(n))(1),所以我们可以这样说:

log(log(n)) < r*log(n) = log(n^r)     for large enough values of n

现在,以e 为底对每一边进行指数运算。请注意,对于足够大的n,左手和右手的值都是正数:

e^log(log(n)) < e^log(n^r)
log(n) < n^r

此外,通过类似的方式,我们可以证明对于任何常量c,并且对于足够大的n 值:

c*log(n) < n^r

因此,根据定义,这意味着n^r 不在O(log(n)) 中,而您的具体情况:n^0.25 不在O(log(n)) 中。


脚注:

(1)如果还是不确定,新建一个变量m=log(n),是不是比r*m不在O(log(m))里清楚?如果您想进行练习,证明它很容易。

【讨论】:

    猜你喜欢
    • 2012-11-08
    • 2021-05-13
    • 2021-12-11
    • 2016-07-18
    • 2016-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多