# How to Convert a Recursive Procedure into Iterative

Find an example or a recursive procedure and represent it as an iterative procedure. what challenges would you face and how can we resolve it?

Â© BrainMass Inc. brainmass.com December 15, 2022, 7:48 pm ad1c9bdddfhttps://brainmass.com/math/discrete-math/convert-recursive-procedure-iterative-251275

#### Solution Preview

Recursive Procedure: A recursive procedure is a method or a function that calls itself over and over again as long as it satisfies the recursive conditionm[1][2]. Recursive procedures are easier to design as they more closely reflect the modeling technique and mathematical properties. Interestingly, examples of recursive are present in nature. Fractals and flower petal patterns are two such examples.

The Fibonacci sequence is a popular example of recursion[3]:

[base cases]

Fib(0) is 1

Fib(1) is 1

For all integers n > 1: Fib(n) is (Fib(n-1) + Fib(n-2)) [recursive definition]

We can write ...

#### Solution Summary

Gives an example of a recursive procedure and represents it as an iterative procedure. Furthermore, it describes the challenges faced during the conversion and how to resolve it.