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 are the advantage and disadvantage of recursion

Answer Posted / vasu jain

Recursion
Advantage
i. Usually simplicity.
ii. Although at most of the times a problem can be solved without recursion, but in some situations in programming, it is a must to use recursion. For example, a program to display a list of all files of the system cannot be solved without recursion.
iii. The recursion is very flexible in data structure like stacks, queues, linked list and quick sort.
iv. Using recursion, the length of the program can be reduced.
Disadvantage
i. It requires extra storage space. The recursive calls and automatic variables are stored on the stack. For every recursive calls separate memory is allocated to automatic variables with the same name.
ii. Often the algorithm may require large amounts of memory if the depth of the recursion is very large. If the programmer forgets to specify the exit condition in the recursive function, the program will execute out of memory.
iii. The recursion function is not efficient in execution speed and time.
iv. Some function calls inside recursion are repeated or duplicated just like fibonacci

Is This Answer Correct ?    47 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

i want to know the procedure of qualcomm for getting a job through offcampus

2409


What is variable and explain rules to declare variable in c?

1015


How can I dynamically allocate arrays?

1035


What is the most efficient way to store flag values?

1124


Define Spanning-Tree Protocol (STP)

1069


What is the purpose of & in scanf?

1007


What is structure and union in c?

1067


i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical

2275


write a c program to find the sum of five entered numbers using an array named number

2073


What is scanf () in c?

1054


Was 2000 a leap year?

1000


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

1225


What is #ifdef ? What is its application?

1052


When should you use a type cast?

1053


What is an auto keyword in c?

1040