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

What is || operator and how does it function in a program?

633


What is the advantage of an array over individual variables?

746


What is a wrapper function in c?

592


How can you check to see whether a symbol is defined?

595


What do you understand by friend-functions? How are they used?

649






Is there a way to switch on strings?

623


What is atoi and atof in c?

620


Which control loop is recommended if you have to execute set of statements for fixed number of times?

812


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

741


Explain what is the benefit of using #define to declare a constant?

614


What is p in text message?

543


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

726


What is a program flowchart?

608


Why c language?

651


How can I sort more data than will fit in memory?

632