Question: a) Write a recursive method double power (double a, int b) which computes a to the bth power. Your method should work for both

a) Write a recursive method double power (double a, int b) which 



a) Write a recursive method double power (double a, int b) which computes a to the bth power. Your method should work for both positive and negative inputs. You are not allowed to use a power operator - you can only use +, -, *, and /. Also, no loops are allowed. Your solution may be pseudocode or in the general style of Java. 3P. b) What is the tightest Big-O complexity of your method as a function of a and b? Explain your answer. 2P. c) What is the maximum depth of the call stack as a function of a and b? 2P.

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 Programming Questions!