**Hint:**You can adjust the default video playback speed in your account settings.

**Hint:**You can set your subtitle preferences in your account settings.

**Sorry!**Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

# Exploring an Iterative Algorithm

**00:00**
Exploring an Iterative Algorithm.

**00:04**
What if you don’t even have to call the recursive Fibonacci function at all? You can actually use an iterative algorithm to compute the number at position *N* in the Fibonacci sequence.

**00:15**
You know that the first two numbers of the sequence are zero and one and that each subsequent number in the sequence is the sum of its previous two predecessors.

**00:24**
So you can just create a loop that adds the previous two numbers, *N* minus 1 and *N* minus 2, together to find the number of position *N* in the sequence.

**00:33**
The bold number in the diagram on-screen represents the new numbers that need to be calculated and added to the cache in each iterative step. To calculate the Fibonacci number at position *N*, you store the first two numbers of the sequence, zero and one, in cache, then calculate the next numbers consecutively until you can return cache *N*.

**00:55**
In the next section, you’ll take a look at generating the Fibonacci sequence in Python using different algorithms and programming strategies.

Become a Member to join the conversation.