News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Recursion

Started by Bieb, January 20, 2005, 02:45:36 AM

Previous topic - Next topic

roticv

Quote from: BogdanOntanu on January 21, 2005, 05:22:20 PM

Recursion is usually slower that simple function calls, and it eats up much more memory on stack than anything else.
Normaly recursion should be avoided unless you are lazy or you want to use very simple solutions.

But there is fun in recursion and sometimes it is the most simple solution to problems ...

Still the kind of problems that recursion applys to are usually generated by "mind oriented" people ;)  and this kind of people have an inteligence that is very close to stupidity

So that is why recursion solves such problems (for example the tree structure of folders).
Recursion is useful for DP questions and divide and conquer type of question. Along with DFS etc etc. It is not impossible to code without recursion, but I think recursive function just makes it easier to code. It could be use as a space optimisation btw. JohnFound had a wonderful example.