Question

I need to derive the Big-O complexity of this expression:

c^n + n*(log(n))^2 + (10*n)^c

where c is a constant and n is a variable.
I'm pretty sure I understand how to derive the Big-O complexity of each term individually, I just don't know how the Big-O complexity changes when the terms are combined like this.
Ideas?

Any help would be great, thanks.

Was it helpful?

Solution

The O() notation considers the highest term; think about which one will dominate for very, very large values of n.

In your case, the highest term is c^n, actually; the others are essentially polynomial. So, it's exponential complexity.

OTHER TIPS

The answer depends on |c|

If |c| <= 1 it's O(n*(log(n))^2)

IF |c| > 1 it's O(c^n)

Wikipedia is your friend:

In typical usage, the formal definition of O notation is not used directly; rather, the O notation for a function f(x) is derived by the following simplification rules:

  • If f(x) is a sum of several terms, the one with the largest growth rate is kept, and all others omitted.
  • If f(x) is a product of several factors, any constants (terms in the product that do not depend on x) are omitted.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top