Order the growth rate of a function

随声附和 提交于 2019-12-13 23:09:21

问题


I have come across some of the difficulties during doing this question. The question is: rank the following by growth rate:

n, √n, log n, log(log n), log2 n, (1/3)n, n!

What is the order for the above question? I would also like to know if is there any easy way to determine that (in general)?

My answer to this question is

(1/3)n ⋞ log(log n) ⋞ log n ⋞ log2 n ⋞ √n ⋞ n ⋞ n!

Is it correct?


回答1:


You have to learn big O notation.

it's all about exponentiation ranking... you can have:

  • 1 constant (exp n^0)
  • 2 logarithmic (exp n=1/c)
  • 3 linear (exp n^1)
  • 4 polinomial (exp n^c)
  • 5 exponential (exp c^n)
  • 6 factorial (exp n!)

that's the basic rule. On the long run each one "wins" against the lower ones (e.g. rule 5 wins over 4,3,2 and 1)

Using this principle, it is easy to order the functions given from asymptotically slowest-growing to fastest-growing:

  1. (1/3)^n - this is bound by a constant! O(1)
  2. log(log n) - log of a log must grow slower than log of a linear function.
  3. log n
  4. log^2 n
  5. √n - n^(1/3), sub-linear, but faster than any log
  6. n - linear is a 1st degree polynomial
  7. n! - factorial grows faster than any exponential.


来源:https://stackoverflow.com/questions/22813551/order-the-growth-rate-of-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!