-4

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?

  • Usually you would consider only the `n^5`, as this is the most relevant part. – Gabriel Sep 12 '16 at 22:58
  • Maybe you should have posted it in [some other community](http://programmers.stackexchange.com/) – Gabriel Sep 12 '16 at 23:04
  • 1
    It's not clear what exactly you are asking. ```O(n!)``` is always a valid answer (except for crazy Ackermann-functions and co.) as it bounds from above. Just get the definition and insert the right constants. This will also work for ```n^5``` which is the slowest-growing function according to big-O notation. Why would you use logs? What exactly do you want to achieve? – sascha Sep 12 '16 at 23:06

1 Answers1

1

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

JosEduSol
  • 5,268
  • 3
  • 23
  • 31