How would I set up a recursive formula for time-complexity for this code:
int b(int n, int x) {
int erg = x;
if (n>1) {
for (int i = 1; i <= n; i++) {
erg = erg+i;
}
for (int k=0; k<3; k++) {
erg = erg + b(n/3,erg/9);
}
}
return erg;
}
Is my assumption correct, that it would be something like this? $$T(n)=n(T(\tfrac{n}{3})+n)$$
But how to deal with the if statement and the second for loop, since it is independent of $n$?