asymptotic-complexity

If f(n)=O(g(n)), then shouldn't f(n)∗log2(f(n)^c)=O(g(n)∗log2(g(n))) depend on the value of C?


If f(n)=O(g(n)), then shouldn't f(n)∗log2(f(n)^c)=O(g(n)∗log2(g(n))) depend on the value of C?

Here C is a positive constant. According to me if C is large then the statement would become false and if c is small it'd be true. Hence the outcome is dependent on c.

I am taking a class on algorithms and this is one of the questions I was asked. According to me this should be dependent on constant c but the answer was wrong.


Solution

  • log(x^c)  = c * log(x)
    

    So,

    log2(f(n)^c) == c * log2(f(n))
    

    Therefore,

    f(n)∗log2(f(n)^c) = c * f(n) * log2(f(n))
    
                       = O(g(n)∗log2(g(n)))