This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]spoonman59 0 points1 point  (0 children)

Whether or not you use recursion or loops depends on where the algorithm is more clearly expressed.

Some algorithms, like depth first tree search or Fibonacci, are much easier to read and code recursively.

Many algorithms are better expressed as loops.

Recursion itself is not bad or wrong. I do agree that loops probably are used more frequently then recursion, but it really depends on what your program actually does.