As I was told, recursion is a good way to make things simple in terms of writing programming code, but the outcome usually involves extra overheads. I was also told that for some recursion algorithms it is possible to adapt them to make corresponding nonrecursion ones. I wonder if there's a generic way to do that. And if so, are there any literatures regarding that matter that you would like to recommend? Thank you very much in advance!!

Recommended Answers

All 2 Replies

Ofcourse there are generic ways to make a recursive method non-recursive. Just google for it. U wil get that.

Regarding the use of recursive functions: It is not recommended always because it may lead to stack-overflow and crash of your program if the iterations are large in numbers.
But its a very easy way to some some very typical problems which are a bit difficult to solve using non-recursive functions.

Thank you very much! I'll try gooling for it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.