Design a recursive algorithm for computing 2^n for any non-negative integer n by the formula 2^n = 2^(n-1) + 2^(n-1). Prerequisites : There must be an addition operation perform
int computepowerOfTwo(int power) {
if(power == 1)
return 1;
else
return (2*computepowerOfTwo(power-1)) + (2*computepowerOfTwo(power-1))
}
When I supply power as 3 initially it returns 16