Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

recursion. was: stack size. should be: on a different list



On Friday, June 20, 2003, at 04:35 PM, 
email@hidden wrote:

>>
>> Lazy programmers! Extremely lazy programmers I call them! :) It would
>> probably even be quite a bit faster as well if they removed the
>> recursion.
>
> Indeed - hasn't it been proven that any recursive algorithm can be
> reimplemented iteratively?
>
> Recursion may be elegant, but stack space limits it badly, and it's
> almost always slower, because of all of the function calling overhead
> (function calls also tend to defeat the optimisations modern compilers
> could make if the implementation were iterative).
>

That's as may be, but for some things it just doesn't make sense. Can 
you conceive of writing alpha-beta or iterative deepening search 
non-recursively? It just doesn't make sense, and makes a mess of the 
programming by mixing the algorithm with details of its implementation 
at the lowest level. Fortunately, this doesn't usually seem to be a 
problem [yet] for search algorithms. But I'm sure there are other 
problems that are similar, where doing the recursion "manually" is 
counter-intuitive and counter-productive.

Markian
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/x11-users
X11 for Mac OS X FAQ: http://developer.apple.com/qa/qa2001/qa1232.html
Report issues, request features, feedback: http://developer.apple.com/bugreporter
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.