What is the dominant term in 2 ^ n or n ^ 2 for a large O record

I watched the Big O notation and ran into an operating account 2^n+n^2. I understand that the practice of a large O record is to remove constants and low-order members, however, I cannot determine which one to do O(n). I think it might be 2^n, but no luck finding anything to offer it.

+4
source share
5 answers

Look at the growth factor over time. For the first eight values n, it O(n^2)works:

0, 1, 4, 9, 16, 25, 36, 49 ...

O(2^n) gives two degrees:

1, 2, 4, 8, 16, 32, 64, 128 ...

It should be pretty obvious which one is growing faster.

, . O(1.1^n) , O(n^10) n, , , 1, , n .

+4

L'Hopital:

lim_{n -> infinity} (n^2 / 2^n )

= 1/log(2) lim_{n -> infinity} (2n / 2^n)

= 1/log(2)^2 lim_{n -> infinity} (2 / 2^n)

= 0

n^2 = o(2^n), n^2 = o(2^n).

: f(n) = O(g(n) , f(n) g(n) , n . f(n) = o(g(n)) , , n , g(n) f(n) . :

  • f(n) = o(g(n)) , f(n)/g(n) , n .

  • o(g(n) , f(n) = o(g(n)).

: a b, n^2 <= a | 2^n | n >= b, .

+4

2 ^ n , n.

+3

@ShadowRanger . .

, 2^n n^2. , n^2 , 2^n, 2^n .

, n-->∞ ( , n ), 2^n , n^2. enter image description here

+3

.

, , :

2n_gte_n2, all_n_gte_n0


, n_eq_5:

32_gte_25

, , n0:

step1
step2
step3
step4

n0_gte_5.

, conclusion

+2

Source: https://habr.com/ru/post/1623493/


All Articles