Reputation: 49
is Recursion is more general than Iteration?
for me Iteration means repetitive control using language constructs other than subroutine calls (like loop-constructs and/or explicit goto’s), whereas recursion means as repetitive control obtained using subroutine calls). which is more general in these two?
Upvotes: 0
Views: 153
Reputation: 51998
In so far as it is not opinion-based, the most reasonable answer is that neither recursion nor iteration is more general than the other. A language can be Turing complete with recursion but no iteration (minimal Lisps are like that) and a language can also be Turing complete with iteration but no recursion (earlier versions of Fortran didn't support recursion). Both recursion and iteration are widely used. Iteration is probably more commonly used since for every person who learns programming with something like Lisp or Haskell there are probably a dozen who learn programming with things like Java or Visual Basic -- but I don't think that "most commonly used" is a good synonym for "general".
Upvotes: 1
Reputation: 100622
Voted to close as likely to prompt opinion-based responses; my opinion-based response is: recursion is more general because:
Conversely iteration tends to be a specific language-level construct allowing only a direct linear traversal.
Upvotes: 2