[英]Can't calculate growth rate of function with log and fraction
I am trying to solve a question about getting growth rate in the image below, but I can't. 我正在尝试解决有关在下图中获取增长率的问题,但我不能。
From what I have learned before, if there is a fraction, we usually do not care of denominator, but consider numerator part, which is "2+3n". 根据我以前的了解,如果有分数,我们通常不在乎分母,而是考虑分子部分,即“ 2 + 3n”。
Thus, from my perspective the answer is that "2+3n < 2n+3n = 5n with witness c=5 and k=1" or "2+3n < n+3n = 4n with witness c=4 and k=2", both resulting in O(n). 因此,从我的角度来看,答案是“见证人c = 5且k = 1时2 + 3n <2n + 3n = 5n”或“见证人c = 4且k = 2时2 + 3n <n + 3n = 4n” ,两者都导致O(n)。
However, this is incorrect according to the answer. 但是,根据答案,这是不正确的。
Can you show the whole calculation steps that how I can reach to that answer, Big-theta(root(n)/log(n))? 您能否显示我如何得出答案的整个计算步骤,Big-theta(root(n)/ log(n))?
You just need to follow big O notation definition . 您只需要遵循大的O符号定义即可 。 For these, I like using the limit definition of big O:
对于这些,我喜欢使用big O的极限定义:
f(n) is in O(g(n)) if and only if:
lim n-> infinity |f(n) / g(n)| < infinity
Then apply it to your problem where: 然后将其应用于您的问题,其中:
f(n) = (2+3n)/(5sqrt(n)(1+4logn))
g(n) = sqrt(n) / log(n)
And just do some algebra on the result: 然后对结果做一些代数:
lim n-> infinity: |f(n)/g(n)| =
= |(2+3n)log(n)/(5sqrt(n)(1+4logn)sqrt(n))| <=
<= |5nlog(n)/5sqrt(n)(1+4logn)sqrt(n))| =
= |nlogn/ (sqrt(n) * sqrt(n) * (1+4logn)| =
= |nlogn / n(1+4logn)| =
= |logn / (1+4logn)| <= |logn / 4logn| = 1/4 < infinity
From this, and from definition of big O notation, this proves f(n)
is in O(g(n))
. 由此,并根据大O符号的定义,证明
f(n)
在O(g(n))
。 You can similarly show big Omega, by showing lim n->infinity |g(n)/f(n)| < infinity
通过显示
lim n->infinity |g(n)/f(n)| < infinity
,您可以类似地显示大欧米茄lim n->infinity |g(n)/f(n)| < infinity
lim n->infinity |g(n)/f(n)| < infinity
, and by showing it is both O(g(n))
and Omega(g(n))
, you can conclude this is tight bound ( Theta(g(n)
). lim n->infinity |g(n)/f(n)| < infinity
,并显示它既是O(g(n))
又是Omega(g(n))
,则可以得出结论:这是紧密界限( Theta(g(n)
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.