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.
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.