Quote:
|
Originally Posted by Rickertsen2
Recursion is a bad pracice on any platform and should be avoided....
|
That statement is completely false. The use of recursion completely depends on the problem at hand.
For example, the non-recursive solution to the classic Towers of Hanoi problem is significantly more complicated than the recursive solution.
Or, a non-recursive program to find and show the correct path through a maze is significantly more difficult to implement than the recursive solution.
Recursion is an essential technique for any application which uses a tree data structure. I've written several web application that require directory traversal... without recursion, these would have been near impossible.
I'm not going to disagree with you that recursion is a bad practice on the robot controller due to its limited memory and stack, but to state that recursion is a bad practice and should be avoided is completely false. There are advantages and disadvantages to recursive algorithms vs. iterative algorithms - in some cases, the recursive solution is better than the iterative solution, in other cases, it isn't. It depends completely upon the problem at hand.