The Fibonacci series

Let's consider an example to understand how dynamic programming works. We use the Fibonacci series to illustrate both the memoization and tabulation techniques.

The Fibonacci series can be demonstrated using a recurrence relation. Recurrence relations are recursive functions that are used to define mathematical functions or sequences. For example, the following recurrence relation defines the Fibonacci sequence [1, 1, 2, 3, 5, 8 ...]: 

func(1) = 1
func(0) = 1
func(n) = func(n-1) + func(n-2)

Note that the Fibonacci sequence can be generated by putting the values of n in sequence [1, 2, 3, 4, ...].

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset