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
  • 73,212
  • 30
  • 182
  • 400

0 Answers0