I have the following function, and I need to find the Theta Notation:
void aux(int n){
for(int i = n; i>2; i = sqrt(i))
printf("*");}
void f1(int n){
aux(n);
aux(n*n);
aux(n*n*n);}
I can assume that sqrt(i) has the time complexity of Theta(1).
I watch the series as it goes like that:
i = n^(1/(2^0)), n^(1/(2^1)), n^(1/(2^2)), ... , n^(1/(2^k))
and there for:
2 = n^(1/2^k) -> 1/2^k = log(n) -> 1/log(n) = 2^k
and now:
k = log(1/log(n)) = log((log(n))^(-1)) = -1*log(log(n)) =Theta(log(log(n))
I do know that the final solution IS Theta(log(log(n)) but I want to know that my calculation is correct and it's ok to say that:
-1*log(log(n)) = Theta(log(log(n))