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".
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).
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))?
You just need to follow big O notation definition . For these, I like using the limit definition of 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))
. You can similarly show big Omega, by showing 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)
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.