Iterative Solution
noun
say it: “IT-er-uh-tiv suh-LOO-shun” /ˈɪtərətɪv səˈluʃən/
A way of solving a problem by repeating steps with a loop, instead of having a function call itself.
What is an iterative solution?
An iterative solution solves a problem by repeating steps with a loop instead of having a function call itself. Any recursion can be rewritten this way: a straight line, like a set of nesting dolls, needs one variable, and branching data, like a menu, needs a stack of the pieces still to visit.
In a sentence
- “The reviewer asked for an iterative solution, so I counted the dolls with a while loop instead of recursion.”
Level: Journeyman · More Data Structures terms at this level
Updated