We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

What is a linear recursion? What is a binary recursion? What is a tail recursion? How to improve recursion?

Medium Priority
457 Views
Last Modified: 2012-05-06
just like the title,
-What is a linear recursion?
-What is a binary recursion?  
-What is a tail recursion?
-How to improve recursion?
-What are the pros and cons of using recursion?  

 I don't understand quite well on these topics.
Comment
Watch Question

Commented:
Linear recursion means that a function calls itself at most one time. The stack grows linearly; the algorithm never explores several branches at once.

Binary recursion means that a function makes at most two recursive calls. For example for exploring a binary tree: look left and look right.

Tail recursion mens that the recursive call occurs at the end of the function, when all the local work is done. This type of function can often be rewritten more tightly and more efficiently as a non-recursive loop.

Improving recursion in terms of optimization means often to get rid if it. It can also mean to reduce the amount of stack space needed for each iteration, or use forward-looking techniques to reduce the number of recursive calls. Finally, it can mean to avoid exploring several branches simultaneously.

The advantages of using recursion include: clean code, efficient way to traverse a hierarchy or a tree, ease of maintenance, adaptiveness.

The cons are: there often exist faster algorithms, you can easily fill your stack space, it's difficult to debug and detect cyclic bugs, there can be an exponential efficiency loss with growing data structures.

See also
http://en.wikipedia.org/wiki/Recursion
http://en.wikipedia.org/wiki/Tail_recursion

Does that help?
(°v°)

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.