Question: 1, (15 points) Consider the following recursive definition of computing the n-th power of 3, where n>=1 powerThree(n) if (n-1) return 3 else if (n%2-0)

1, (15 points) Consider the following recursive definition of computing the n-th power of 3, where n>=1 powerThree(n) if (n-1) return 3 else if (n%2-0) powerThree(n/2) return y y else y-powerThree(n-1)/2) return y*y*3 (a) (5 points) Show an example execution given the input powerThree(9). Specifically, list all calls to the function in the order in which they occur, with arguments (b) (5 points) Write an expression f(n) that gives the run time of this code in the form of a recursion. f(n)-^base case; recursive case) (c) (5 points) Simplify your answer f(n) from Part b as much as possible by eliminating the recursion. Show your work step by step
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
