Search code examples
time-complexitybig-ocomputer-sciencecomplexity-theory

Big-O notation of 8^log2(n)


I'm confused about what the big-O notation of 8^(log2(n)) would be.

Would you just be able to change it to O(8^n) since the log2 would somewhat act as constant that just reduces the value of n? or would it be something else?

In a somewhat similar case what would be the big-O for log2(n^n). would this just be O(log2(n))?


Solution

  • We'll need the following properties of logs and exponents to understand this one:

    1. bLogb(x) = x

    2. k . Logb(x) = Logb(xk)

    3. (xa)b = xa.b


    For the first problem:

    8Log2(n)

    = (23)Log2(n) (because 8 = 23)

    = 23 . Log2(n) (using Prop#3)

    = 2Log2(n3) (using Prop#2)

    = n3 (using Prop#1)

    = O(n3)


    For the second problem:

    Log2(nn)

    = n . Log2(n) (using Prop#2)

    = O(n Log(n))