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 || operator and how does it function in a program?
What is the advantage of an array over individual variables?
What is a wrapper function in c?
How can you check to see whether a symbol is defined?
What do you understand by friend-functions? How are they used?
Is there a way to switch on strings?
What is atoi and atof in c?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
Explain what is the benefit of using #define to declare a constant?
What is p in text message?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
What is a program flowchart?
Why c language?
How can I sort more data than will fit in memory?