Question: Python recursion - Draw the recursion tree that represents the execution process, and the cost of each call. And state the asymptotic runtime for each:
Python recursion - Draw the recursion tree that represents the execution process, and the cost of each call. And state the asymptotic runtime for each:

i. Draw the recursion tree that represents the execution process, and the cost of each call ii. Conclude the total (asymptotic) running time. Note: For the simplicity of the analysis of sections (b) and (c), you may assume that n is a power of 2, therefore it can always be divided evenly by 2. def funl (n): if (n -0): return 1 else: partl funl (n-1) part2 -funl (n-1) res = part1 part2 return res b. def fun2 (n): if (n-0): return 1 res - fun2 (n//2) return res else: C. def fun3 (n): if (n 0) return 1 else: res- fun3 (n//2) for i in range (1, n+1): res i return res
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
