+ 1
Which is better approach Iterative or recursive while writing methods in Java?
E.g: Fibonacci series program can be written in iterative as well as in recursive way. Which approach has performance or any other benefits?
2 ответов
+ 7
iteration loops to repeat lines of code and recursion is a function that calls itself to repeat
+ 1
Here's the link which talks about performance impact of using recursion and iteration:
https://stackoverflow.com/questions/2651112/is-recursion-ever-faster-than-looping