Using an aan1 a times a to the n1 to design a recursive alg
Using an = a*a^n-1 (a times a to the (n-1) to design a recursive algorithm for computing a^n (a to the n). Set up and solve a recurrence relation for the number of times that algorithm\'s basic operation is executed.
Solution
int aPowerN(int a,int n)
{
if(n==1)return 1;
if(n>=1)return n*aPowerN(a,n-1);
}
The operation is executed n times and hence complexity is O(n)
