On Aug 31, 2010, at 5:32 PM, Paul McNett wrote:
> I agree, by the way, with using recursion for tree traversal. But you may
> have to put
> checks in your recursive function to catch possible infinite recursion:
That's no different than iterative approaches to the same data. Both
will create infinite loops with circular data instead of treed data. That's not
a knock against either approach; it's a knock against whomever set up the data
in a circular fashion.
> Obviously, you are aware of all this, but it wouldn't be fair to blame the
> programmer
> of the recursive function of misusing recursion if an infinite-loop-infested
> tree
> were thrown at it one day.
Well, the point is that the data is no longer a tree.
> Recursion is awesome. Powerful and simple. But once you add checks in them to
> deal
> with edge-cases, recursive functions can get unwieldy pretty quickly. With
> great
> power comes great responsibility I guess!
For those who detest recursion, please name one algorithm that is
extremely powerful and perfectly safe, whether in the hands of a novice
programmer, or when applied to something it is not designed to handle. For that
is what the arguments you've presented against recursion amount to.
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.