We all know iterations and recursions are a powerful thing in programming. But this doubt always troubles me whenever I write an iteration or recursion. Can every recursive problem solved using iteration and vice-versa? We can avoid efficiency for simplicity. Only thing is is it possible for all?
$\begingroup$
$\endgroup$
2
-
1$\begingroup$ I believe by using the stack data structure, yes, since you can just simulate the recursion stack. $\endgroup$Throckmorton– Throckmorton2019-11-21 16:49:50 +00:00Commented Nov 21, 2019 at 16:49
-
$\begingroup$ Oh what I can't upvote your comment... Thanks $\endgroup$J Arun Mani– J Arun Mani2019-11-21 16:57:45 +00:00Commented Nov 21, 2019 at 16:57
Add a comment
|