Power Function Using Recursion
A more efficient solution:
int Pow3(int X, int N)
{ if (N==0) return 1;
else { int HalfPower = Pow3(X, N/2);
if ( N % 2 == 0)
return HalfPower * HalfPower;
else
return X * HalfPower * HalfPower; }}
Previous slide
Next slide
Back to first slide
View graphic version