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

(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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!