What do you mean by Base case, Recursive case, Binding Time,
Run-Time Stack and Tail Recursion?

Answer Posted / wonder surong

These terms are found in Recursion.
1.Base Case:it is the case in recursion where the answer is
known,or we can say the termination condition for a
recursion to unwind back.
For example to find Factorial of num using recursion:

int Fact(int num){

if(num==1 || num==0)//base case
return 1;
else // recursive case:
return num*Fact(num-1);
}

2.Recursive case:It is the case whcih brings us to the
closer answer.

Run Time Stack:It is a system stack us to save the frame
stack of a function every recursion or every call.
This frame stack consists of the return address,local
variables and return value if any.

Tail Recursion:The case where the function consist of
single recursive call and it is the last statement to be
executed.A tail Recursion can be replace by iteration.
The above funtion consists of tail recursion case.
where as the below function does not.

void binary(int start,int end,int el){
int mid;
if(end>start){
mid=(start+end)/2;
if(el==ar[mid])
return mid;
else{
if(el>ar[mid])
binary(mid+1,end,ele);
else
binary(start,mid-11,ele);
}
}
}

Is This Answer Correct ?    38 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between null and void pointer in data structures?

703


What is non linear data structure with example?

508


What is precision in data structures?

667


What are the different data structures?

512


What does bubble sort do?

457






Can tuple be sorted?

503


Difference between arraylist and linkedlist?

604


How does max heap work?

499


Which interface treemap implements?

558


What is an iterative algorithm?

538


List out the advantages of using a linked list?

500


What is the use of data structure in real life?

500


What is bubble sort and quick sort?

525


How do I sort hashset?

497


How to pass in data structure exam?

515