Search code examples
algorithmbig-ologarithm

Determine the Big O Notation:


5n^5/2 + n^2/5

I tried eliminating the lower order terms and coefficients, not producing a correct answer.

Not sure if I should use logs?


Solution

  • Let f(n) = (5n^5)/2 + (n^2)/5 = (5/2)*n^5 + (1/5)*n^2

    The Big O notation for f(n) can be derived from the following simplification rules:

    • If f(n) is a sum of several terms, we keep only the one with largest growth rate.
    • If f(n) is a product of several factors, any constant is omitted.

    From rule 1, f(n) is a sum of two terms, the one with largest growth rate is the one with the largest exponent as a function of n, that is: (5/2)*n^5

    From rule 2, (5/2) is a constant in (5/2)*n^5 because it does not depend on n, so it is omitted.

    Then: f(n) is O(n^5)

    Hope this helps. Check Introduction to Algorithms