Ask a question
          

Recursion

<<Previous Next>> 
Data structure  - What is the recursion? - July 31, 2009, 10:55 am by Vidya Sagar

What is the recursion?

Recursion is an approach in which a function calls itself with an argument. Upon reaching a termination condition, the control returns to the calling function.

Explain the terms Base case, Recursive case, Binding Time, Run-Time Stack and Tail Recursion.

Base case: A case in recursion, in which the answer is known when the termination for a recursive condition is to unwind back.

Recursive Case: A case which returns to the answer which is closer.

Run-time Stack: A run time stack used for saving the frame stack of a function when every recursion or every call occurs.

Tail Recursion: It is a situation where a single recursive call is consisted by a function, and it is the final statement to be executed. It can be replaced by iteration.

Data structure  - Base case, Recursive case, Run-Time Stack and Tail Recursion - Feb 27, 2010, 11:15 am by Rajmeet Ghai

Explain the terms Base case, Recursive case, Run-Time Stack and Tail Recursion.

Base case: - In this case, the output is known or when using recursion, the termination condition which restarts the function is called as base case.

Recursive case: - A case which brings user to the closest answer.

Binding time:-

Run-Time Stack: - Run Time stack contains return address, local variables and return value if any of a recursive function call.

Tail Recursion: - Tail recursion consists of one recursive call with the last statement to be executed. To find factorial of a given number is an example of tail recursion. .

<<Previous Next>> 



Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
 
Home | Login | About us | Sitemap | Contact us