Here is my function. It is a simple one, I'm just not confident on what the answer is.
int calcul( int n) {
if(n=1)
return 1;
else
return calcul(n/2) + 1;
}
Now, to get the complexity, I do:
T(n) = T(n/2) + O(1)
T(n/2) = T(n/4) + O(1)
...
T(1) = O(1)
Now, adding the equations, I'm getting
T(n) = O(1) + O(1)...
so what is the final answer ?