Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Big-O complexity of c^n + n*(logn)^2 + (10*n)^c

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.

like image 404
zebraman Avatar asked Feb 04 '10 04:02

zebraman


2 Answers

The answer depends on |c|

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

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

like image 142
Maciej Hehl Avatar answered Sep 28 '22 15:09

Maciej Hehl


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.

like image 20
Chris Jester-Young Avatar answered Sep 28 '22 15:09

Chris Jester-Young