views:

51

answers:

1
+1  Q: 

Adding two big Os

If a function A calls n^c functions B that runs in O(n^2) time, what is the time complexity of function A? Is it just polynomial (n^c) as well as c has just gotten bigger?

+5  A: 

If a function A calls another function B, the total complexity is the product of the complexities of A and B. So in this case the total complexity is O(nc · n2) = O(nc + 2).

The general rules for products:

ƒ1 ∈ O(g1) and ƒ2 ∈ O(g2) ⟹ ƒ1·ƒ2 ∈ O(g1·g1)

ƒ·O(g) ∈ O(ƒ·g)

Gumbo
i knew I should have added as an answer!
Mitch Wheat
And that would be O(n^c) but just with a slightly larger `c` :-)
paxdiablo