January 2020
Intermediate to advanced
432 pages
10h 18m
English
We will do a comparison by first solving a problem using regular methods and then with DP. Along the way, we will identify key elements that make our solution a DP one. What most experienced programmers find is that they likely have done DP in some capacity, so don't be surprised if this all sounds really familiar. Let's open up the Chapter_2_1.py example and follow the exercise:
def Fibonacci(n): if n<0: print("Outside bounds") elif n==1: return 0 # n==1, returns 0 elif n==2: return 1 # n==2, returns 1 else: return Fibonacci(n-1)+Fibonacci(n-2) print(Fibonacci(9))
Read now
Unlock full access