What are advantages and disadvantages of recursive
calling ?
Answer Posted / sachin mahajan
Advantages:
Through Recursion one can Solve problems in easy way while
its iterative solution is very big and complex.
Ex : tower of Hanoi
You reduce size of the code when you use recursive call.
Disadvantages :
Recursive solution is always logical and it is very
difficult to trace.(debug and understand)
Before each recursive calls current values of the varibles
in the function is stored in the PCB, ie process control
block and this PCB is pushed in the OS Stack.
So sometimes alot of free memory is require for recursive
solutions.
Remember : whatever could be done through recursion could be
done through iterative way but reverse is not true.
| Is This Answer Correct ? | 103 Yes | 30 No |
Post New Answer View All Answers
What is the function of volatile in c language?
Explain the difference between exit() and _exit() function?
How does placing some code lines between the comment symbol help in debugging the code?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
Write a program to swap two numbers without using a temporary variable?
What is void pointers in c?
Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given
What is n in c?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
How can you allocate arrays or structures bigger than 64K?
What is the use of a conditional inclusion statement in C?
Who invented b language?
What is sizeof array in c?
Explain what are the different data types in c?