I have this algorithm:
function f(arr, i, n) {
if (i == n - 1) {
return arr[i];
}
if (i == 0) {
return (arr[i] + f(arr, i + 1, n)) / n;
} else {
return arr[i] + f(arr, i + 1, n);
}
}
It is a recursive algorithm, but it only calls once per lap.
I thought it could be an algorithm with an O (1 ^ n) notation, but if that's the case,
(1 ^ 1) = 1 (1 ^ 2) = 1 (1 ^ 3) = 1
etc
So wouldn't it be an O (1)? With a constant Big O notation?