Here is the faster recursive power function: If n is 0, return 1. If n is even, compute power(x,n/2) and square it. If n is odd, compute power(x,n−1) and multiply by x. Trace power(2,10): you get power(2,5)2. Then power(2,5)=2×power(2,4). Then power(2,4)=power(2,2)2. Then power(2,2)=power(2,1)2. Then power(2,1)=2. Just 5 calls for n=10.
Time complexity: O(logn).
Space complexity: O(logn) due to recursive call stack.