Yes, recursion is often (even usually) easier to understand and easier to implement correctly on the first try. Non-recursive solutions are likely to only be a little bit faster. But, recursive solutions are likely to fail on much "smaller data" and prevent you from providing certain types of interfaces compared to non-recursive solutions. So I prefer non-recursive solutions if I suspect that efficiency will be unusually important, I want to succeed with as large of data as possible, or I want to provide the best possible API (such as if I'm writing code for public reuse).

I go over this in a bit more detail here: (tye)Re: Recursion. The rest of that thread may also be of interest.

Also, one thing I didn't mention before: People sometimes turn to recursive solutions when a simple loop (not even requiring a stack) would make more sense (as in the thread you link to). In such cases, the recursive solution is likely to be harder to understand and to get right on the first try. So, if you find yourself contemplating a recursive solution, you should at least think a bit about how you might solve it without recursion. (:

        - tye (but my friends call me "Tye")

In reply to (tye)Re: bushy recursion a good thing ? by tye
in thread bushy recursion a good thing ? by mandog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.