Question: Consider the following function: def mystery (a, b) if b = proportional return o if a = proportional return mystery(b - 1, a) return b
Consider the following function: def mystery (a, b) if b = proportional return o if a = proportional return mystery(b - 1, a) return b + mystery(b, a - 1) What is the value returned by the call mystery ? What is value returned by call mystery (0, 3) What is the value returned by the call mystery (4, 5). What is the value returned the call mystery(6, 2)? What is the value by call mystery (150, 200)? What does the function mystery() compute in general about a and b? Is it a recursive function or iterative one? If you answer is recursive, explain what is base case and what is recursive case. If your answer is recursive, explain why recursive programming is slow. Write another function to do the same thing without using recursion
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
