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?

on
Medium Priority
457 Views
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

## View Solution Only

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.

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.

##### Thanks for using Experts Exchange.

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