algorithmtime-complexityasymptotic-complexity

How to calculate the upper bound time complexity (`"big O`") of a recursive function?


Suppose I have a recursive function T, and I want to calculate the upper bound timer complexity of this function.

T(1) = 3

T(n) = 3T(n/3) + 3.

How can I find the upper bound of the time complexity of T(n)?


Solution

  • Use the master theorem case formula where a=3, b=3, c=0.

    solution

    I highly recommend the MIT lectures on Algorithms. You can learn more about the Master theorem in lecture 2