简体   繁体   中英

Ordering functions by Asymptotic Growth Rate

List the following functions in non-descending order of asymptotic growth rate. If two or more functions have the same asymptotic growth rate then group them together.

g1(n) = n

g2(n) = n^3 +4n

g3(n) = 2n log(base 2) n

g4(n) = 2^n

g5(n) = 3 ^ (3 * log(base 3) n)

g6(n) = 10^n

I've been looking through several examples online but I have no idea how to do this, it just seems like a completely foreign concept to me. If anyone could help me, that would be much appreciated. how do I even calculate the growth rate?

Many of the techniques that you might find most useful here are tricks for manipulating expressions involving logs and exponents.

First, you might want to review the power rule for logarithms:

a log b c = log b c a .

Next, there's the fact that exponents and logarithms are inverses of one another:

log b b n = b log b n = n

These rules might help you rewrite g 5 (n), for example.

Here's another helpful rule:

(a b ) c = a bc = (a c ) b .

You can actually use the two previous rules to change the bases of exponential functions. For example, suppose you want to compare 2 n to 5 n . Notice that

5 n = (2 log 2 5 ) n

= (2 n ) log 2 5 .

Does that make it easier to see which of these two functions will grow more rapidly?

Finally, you might want to use the following fact: all polynomials grow slower than all exponents whose base is greater than 1. This means that n k grows strictly slower than a n for any n > 1. Similarly, all polynomials grow strictly faster than all logarithms, so log b n < n k for all k > 0.

Using the above rules, see if you can try to rewrite each of these expressions as either a logarithm of n, a polynomial in n, or something exponential in n. From there, you can then rank the logarithmic expressions against themselves, the polynomials against themselves, and the exponentials against themselves, then write them out in order.

Generally speaking, the techniques mentioned here are super useful going forward. I hope that this gets you on the right track!

There's a very simple rule that can help out with these problems. It's very easy to prove using the basic definitions of calculus and complexity (and it might be a good exercise to boot).

Given two functions, f(n) and g(n) :

  • if lim n → ∞ f(n) / g(n) = 0 , then f(n) = o(g(n) .

  • if lim n → ∞ f(n) / g(n) = ∞ , then f(n) = w(g(n) (this follows from the previous point).

  • if lim n → ∞ f(n) / g(n) = c , 0 < c < ∞ , then f(n) = Θ(g(n) .

Looking at your examples here, they can each and every one of which be solved using these. Eg, lim n → ∞ g1(n) / g2(n) = 0 , so g1(n) = o(g2(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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM