Memoization

Learn how to tackle the inefficiency of repeated function calls introduced by recursion.

Use a dictionary

The basic problem in the Fibonacci example is that we are calling fibonacci multiple times, with the same argument. So, each time we are calculating the same value all over again.

svg viewer

Get hands-on with 1400+ tech skills courses.