What should be the time complexity of below code snippet
void doSomething(int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
doSomeOtherStuff(n);
doSomething(n - 1);
}
}
}
void doSomeOtherStuff(int n) {
for (int i = 0; i < n; i++) {
//did some other stuff
}
}
Is the complexity calculation as: n^2(n + n^2) = O(n^4) is correct? If not please explain