Question: You are given the following pseudocode for a recursive algorithm. Algorithm 1 Recursive Function 1 1 : Algorithm RecFunc ( n ) Input: Integer n
You are given the following pseudocode for a recursive algorithm.
Algorithm Recursive Function
: Algorithm RecFuncn
Input: Integer n
: if n then
: return
: else if n is even then
: return n RecFuncn
: else if n is odd then
: return n RecFuncn
: end if
: end Algorithm
a State the base and the recursive cases
b Draw the corresponding recursion tree when RecFunc is invoked.
c Compute the return value as an integer of the function call RecFunc
d Determine its worstcase asymptotic running time in terms of n
e Determine its space complexity in terms of n
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
