+ 13

Which is best

Recursion or iteration

25th Sep 2019, 1:11 AM
Sahil
Sahil - avatar
10 ответов
+ 6
never use recursion in interview if you know iterative code, recursion increases space and time complexity in most of the situations
25th Sep 2019, 6:33 AM
InSane 👻
InSane 👻 - avatar
+ 8
25th Sep 2019, 1:15 AM
Sahil
Sahil - avatar
+ 6
Iteration is a much better option...
25th Sep 2019, 1:13 AM
Jenis Gadhiya
Jenis Gadhiya - avatar
+ 6
Obviously the execution of iteration is much faster than recursion.. Bcoz during recursion stack is made and during the execution of iteration no such structure is made.. Which speedens the execution of the program..
25th Sep 2019, 1:18 AM
Jenis Gadhiya
Jenis Gadhiya - avatar
+ 5
That means
25th Sep 2019, 2:46 AM
Sahil
Sahil - avatar
+ 5
Okkkk sir😅
25th Sep 2019, 7:26 AM
Sahil
Sahil - avatar
+ 4
Overall recursion is best?
25th Sep 2019, 2:46 AM
Sahil
Sahil - avatar
+ 4
I think it's depends about what's the way that the code will be write, both of them have some advantages, but I prefer iteration because I'm not understand well functional programming yet, soon I will
26th Sep 2019, 12:22 AM
Michael Toninger
+ 2
It all depend upon situation. But prefer to use recursion
25th Sep 2019, 2:42 AM
yogesh lodha
yogesh lodha - avatar
+ 1
Depends on the problem, you can solve something only with recursion and not with iteration.
26th Sep 2019, 10:14 PM
Mihai Pop
Mihai Pop - avatar