I'm having a lot of trouble understanding Big Oh.
I'm pretty sure that the following code is O(N).
public static int two1 (int n) {
if (n == 0) {
return 1;
} else {
return 2 * two1(n - 1);
}
}
In the second example, I'm totally lost. Can someone explain to me what notation this would be?
public static int two2 (int n) {
if (n == 0) {
return 1;
} else {
return two2(n - 1) + two2(n - 1);
}
}