-1

What I am trying to do is to sort the following functions:

n, n^3, nlogn, n/logn, n/log^2n, sqrt(n), sqrt(n^3)

in increasing order of asymptotic growth.

What I did is,

n/logn, n/log^2n, sqrt(n), n, sqrt(n^3), nlogn, n^3.

1) Is my answer correct?

2) I know about the time complexity of the basic functions such as n, nlogn, n^2, but I am really confused on the functions like, n/nlogn, sqrt(n^3). How should I figure out which one is faster or slower? Is there any way to do this with mathematical calculations?

3) Are the big O time complexity and asymptotic growth different thing?

I would be really appreciated if anyone blows up my confusion... Thanks!

seung
  • 53
  • 1
  • 7

1 Answers1

1

An important result we need here is:

log n grows more slowly than n^a for any strictly positive number a > 0.

For a proof of the above, see here.

If we re-write sqrt(n^3) as n^1.5, we can see than n log n grows more slowly (divide both by n and use the result above).

Similarly, n / log n grows more quickly than any n^b where b < 1; again this is directly from the result above. Note that it is however slower than n by a factor of log n; same for n / log^2 n.

Combining the above, we find the increasing order to be:

  1. sqrt(n)

  2. n / log^2 n

  3. n / log n

  4. n

  5. n log n

  6. sqrt(n^3)

  7. n^3

So I'm afraid to say you got only a few of the orderings right.


EDIT: to answer your other questions:

  • If you take the limit of f(n) / g(n) as n -> infinity, then it can be said that f(n) is asymptotically greater than g(n) if this limit is infinite, and lesser if the limit is zero. This comes directly from the definition of big-O.

  • big-O is a method of classifying asymptotic growth, typically as the parameter approaches infinity.

meowgoesthedog
  • 14,670
  • 4
  • 27
  • 40