I'm currently studying how to figure out the time complexity of functions but I'm struggling a bit with the subject so far, and I came across a scenario that I really don't understand how to solve.
For the following function:
fun fun1(n: Int, m: Int): Int{
if(n/m == 0)
return 0
else
return 1 + fun1(n/m, m)
}
I have to figure out it's time complexity in two different situations:
a) When m has a set value of 2 (m = 2 for any n)
b) n and m don't have set values
I believe that in either case the complexity would be O(n) for either of them but I'm having a hard time putting that conclusion into an expression, specially for the case where n and m can have any value.
Thank you in advance for any help!