http://qs321.pair.com?node_id=458526


in reply to Recursively-generated Iterators

Nice ++

I wonder how general your technique is - I mean is it applicable only the to computation you present, or is it generally good for all memory-eating recursive computations ? Can one formulate a general algorithm for this transformation ?

By the way, another technique to ease these computations is Memoization. It is almost always very helpful for recursive algorithms like the one you present.

Replies are listed 'Best First'.
Re^2: Recursively-generated Iterators
by Roy Johnson (Monsignor) on May 19, 2005 at 17:27 UTC
    It should be applicable to any algorithm that generates a set where different portions of the set are generated by different recursive calls. That's mostly combinatorial things like this, but Towers of Hanoi would also be a good example. If each item in the returned set required some value from more than one recursive call, you couldn't do it this way.

    Caution: Contents may have been coded under pressure.