C++ simple code base to understand iterative and recursive algorithms. What makes an iterative function faster?

 


IDE - Visual Studio

This project provides exposure to the Fibonacci Sequence, which is a sequence of numbers where each number is the sum of the two numbers before it. 

This project provides two different approaches to calculating the Fibonacci Sequence:

- A simple loop (iterative method).

- A function which calls itself (recursive method) in order to solve bits of  bigger problem and with smaller numbers, the recursive method works quite well. However, as the sequence continues to a bigger number, the repeated functions calls become burdensome and causes the function to lag.

****************************************************************************

Here is a screenshot of what the output should look like:


****************************************************************************

Here is the code base:



Sources

https://dev.to/khalilsaboor/fibonacci-recursion-vs-iteration--474l






Comments

Popular posts from this blog

C++ script - Script to learn map library | struct | transform a vector of keys

Developer's Arsenal: How HashiCorp unites cloud securite and upholds the AWS Well-Architected Framework when implementing Policy as Code using Sentinel One.

How AWS Protects Your Data Privacy and Security- 2025 January