wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> general problem-solving / chatting / whatever >> Recursion
(Message started by: harsh487 on Oct 10th, 2008, 1:47pm)

Title: Recursion
Post by harsh487 on Oct 10th, 2008, 1:47pm
Hi guys,
Is  recursion  the efficient way of solving the questions (if we look only at the time complexity)??

Title: Re: Recursion
Post by towr on Oct 10th, 2008, 2:45pm
That depends entirely on what problem you're dealing with. Using (naive) recursion to calculate Fibonacci numbers is a very bad idea, for example. But for traversing a tree, recursion is quite good.
Recursion helps to break down a problem, but it isn't always good at reusing intermediary results, which means you can end up doing the same work many times over.

Title: Re: Recursion
Post by sunny29 on Mar 22nd, 2012, 2:29am
Recursion is a technique in which a function calls itself again and again until the lower limit is reached to perform a repeated task.





Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board