0

Which one is faster way of getting answer a recursive function or a normal function given that question can be solved by both.

assume factorial question it can be solved by recursion as well as iteration so which should I opt please justify. thanks in advance.

23rd Nov 2016, 3:10 AM
kunal
1 Réponse
+ 4
Iteration is faster because recursion requires multiple function calls, which involves putting variables on the memory stack several times. With iteration you just loop through a single array.
23rd Nov 2016, 6:58 AM
Karl T.
Karl T. - avatar