2

I am confused in calculating the time complexity for a recursive function inside a loop.

Function (int n){
   if(n<=1) return;
   for(int i=1;i<=3;i++)
       Function(n/3);
   }


in the text book answer written for this is theta(n). Please explain how is it so?

Raphael
  • 72,336
  • 29
  • 179
  • 389

0 Answers0