Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / khalith

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.

Is This Answer Correct ?    9 Yes 2 No

Post New Answer

More Data Structures Interview Questions

What is the similarity between a Structure, Union and enumeration?

0 Answers  


What are the best data structure courses for gate preparation?

0 Answers  


What is data structure explain in detail?

0 Answers  


Is it possible to insert different type of elements in a stack? How?

0 Answers  


Can sets contain duplicates?

0 Answers  


What is the difference between a Stack and a Queue.

0 Answers   Genpact, TCS,


What are the disadvantages of sequential storage?

0 Answers  


What is dynamic array how is it created?

0 Answers  


How do you find the depth of a binary tree?

0 Answers  


What are the advantages of merge sort?

0 Answers  


What is complexity algorithm?

0 Answers  


Can you provide some implementation of a dictionary having large number of words?

0 Answers  


Categories