Consider
def mystery(n):
if n <= 0:
return 1
else:
return mystery(n-1) + mystery(n-2)
How many function calls (including the first) are made to compute mystery(4)?
- (A)
- (B)
- (C)
- (D)
Source: GATE DA
Programming · Recursion, Divide & Conquer, Greedy & DP · Problem 1
Consider
def mystery(n):
if n <= 0:
return 1
else:
return mystery(n-1) + mystery(n-2)
How many function calls (including the first) are made to compute mystery(4)?
Source: GATE DA
Free. Sign in with Google to read Srijit's solutions and talk the problems through with everyone in the cohort.