Memoizing Fibonacci Numbers
In this lesson, we are going to reduce the time complexity of the Fibonacci code we wrote using a dynamic programming technique called memoization
We'll cover the following...
In Calculating Fibonnacci Numbers, we established that the recursive implementation of the Fibonacci sequence causes recalculations which result in exponential time complexity.
Let’s memoize the code now and see where that leads us. The basic idea is to check if an array already contains the result of the Fibonacci number that we are trying to find before calculating it.
Pseudocode
...Access this course and 1400+ top-rated courses and projects.