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 #ifdef ? What is its application?
What is dynamic dispatch in c++?
Explain what is the difference between text files and binary files?
What is pointer to pointer in c language?
Why do we use null pointer?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
Is c a great language, or what?
Tell me when is a void pointer used?
What are multibyte characters?
What is sizeof array?
Explain what is wrong in this statement?
Linked lists -- can you tell me how to check whether a linked list is circular?
What is the difference between printf and scanf in c?
What is wild pointer in c?
What is "Duff's Device"?