Data structure - What is the recursion?

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.

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. .
Data structure - Is it possible to insert different type of elements in a stack? How?
Insert different type of elements in a stack - Different elements can be inserted into a stack. This is possible by implementing union / structure data type.......
Data structure - Explain in brief a linked list
Linked list - A linked list is a dynamic data structure. It consists of a sequence of data elements and a reference to the next record in the sequence.......
Data structure - Explain the types of linked lists
Types of linked lists - The types of linked lists are: Singly linked list: It has only head part and corresponding references to the next nodes.......
Post your comment