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


Please Help Members By Posting Answers For Below Questions

How do you do dynamic memory allocation in C applications?

619


What is typedf?

657


How many data structures are there in c?

603


What is wrong with this statement? Myname = 'robin';

806


What is the difference between class and object in c?

571






What is fflush() function?

631


What is the use of header?

610


What are types of preprocessor in c?

609


Can main () be called recursively?

619


explain what are actual arguments?

624


Why functions are used in c?

572


Is swift based on c?

624


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

645


What is call by value in c?

545


How can I determine whether a machines byte order is big-endian or little-endian?

607