Reputation: 15
I know that any recursive method can be written in a way that uses loops (instead of recursion), but can any given iterative method be written recursively?
Upvotes: 1
Views: 470
Reputation: 122
yes, it can! This may seem a bit circular in logic, but there are languages that are 100% turing complete with only iterative structure and others that are only recursive structures.
Therefore the two must be equivalent.
Upvotes: 1