Question: (50 points) . A fast exponentiation function is given below: int expon(int x, int n) /* n is assumed > 0 */ if (n ==

(50 points) . A fast exponentiation function is given below: int expon(int x, int n) /* n is assumed > 0 */ if (n == 0) return 1; else if even(n) return expon(x*x, n/2); else return expon(x, n- 1) *x; where even(n) returns true if n is even and returns false if n is odd. Show that the running time is O(log n). (20 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
