Any recursion can be converted to iteration (and vice versa).
Here's factorial both ways: python # Recursive def factorial_rec(n): if n == 0: return 1 return n * factorial_rec(n - 1) # Iterative def factorial_iter(n): result = 1 for i in range(1, n + 1): result *= i return result Recursion advantages: - Matches problem structure naturally. Cleaner for tree/nested data.
Easier to prove correct Iteration advantages: - No stack limit. Often faster (no function call overhead) - Uses less memory Choose based on clarity and constraints. If recursion is clearer and depth is safe, use it.