What are recursive functions?

What are recursive functions? What are the advantages and disadvantages of Recursive algorithms?

A recursive function is a function which calls itself.
Advantages of recursive functions:
-Avoidance of unnecessary calling of functions.
-A substitute for iteration where the iterative solution is very complex. For example to reduce the code size for Tower of Honai application, a recursive function is bet suited.
- Extremely useful when applying the same solution

Disadvantages of recursive functions :
-A recursive function is often confusing.
-The exit point must be explicitly coded.
-It is difficult to trace the logic of the function.
Difference between an external iterator and an internal iterator
Difference between an external iterator and an internal iterator - An internal iterator is implemented by the member functions of the class....
Explain passing objects by reference, passing objects by value and passing objects by pointer
Passing objects by reference, passing objects by value and passing objects by pointer - The callee function receives a set of values that are to be received by the parameters...
Concepts of throwing and catching exceptions - C++
Explain the concepts of throwing and catching exceptions - C++ provides a mechanism to handle exceptions which occurs at runtime...
Post your comment