What will be the time complexity of this function:
public int calculate(int n, int i, int c) {
if(i >= n || c <= 0)
return 1;
int p1 = 2 * calculate(n, i, c-1);
int p2 = 1 + calculate(n, i+1, c);
return p1 + p2;
}
The function gets called twice, one for all values of 'c' and one for all values of 'i'. Can we say that its time complexity is O(2^(n+c)) If so, is it possible to find a tighter limit?