Is time complexity O(K^3*Log(N))?

F(i) = T^(n-1) * F(i-1)

How is T^(n-1) a O(LogN) here ?

Because,

Matrix exponentiation of T^(n-1) involves matrix multiplication also, inside recursive function “multiply”.

Fast exponentiation is O(LogN).

And, matrix multiplication is O(K^3).

Thus, calculating T^(n-1) should be greater than O(K^3*Log(N)).

@anuj_it,
Yes, complexity of matrix exponentiation is O(k^3. log(n)), what is the doubt…??

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

@abhijeet.srivastava6499 We are calling functions recursively, multiple times, so it needs to be greater isn’t it ?

@anuj_it,
We are calling the recursive function O(log(n)) times, and in each call we are doing O(k^3) operations, thus total complexity = O(k^3.log(n))

@abhijeet.srivastava6499
Okkk… So it means, call to recursive fn() from inside same recursive fn() doesn’t gets multiplied again for computing time complexity ?

Like we do in nested for loop, we multiply the complexity

@anuj_it,
It’s something like,

for(int i=1; I<=log(n); I==){
for(int j=1;j<=k^3;j++){
//O(const.) operation here
}
}