Define Recursion. Explain types and requirement of recursion ?


==> Recursion--

  • A recursive function is a function which either calls itself or is in a potential cycle of function calls.
  • As the definition specifies, there are two types of recursive functions. Consider a function which calls itself: we call this type of recursion immediate recursion and indirect recursion.
  • Ex: Factorial is immediate recursive function.

 

               void A()  {

                B();

             return;

              } 

            void B() {

              C();

            return;

            }

          void C() {

          A();

      return;

           }

 



Share to whatsapp

More Questions from Data Structures and Algorithms Module 2

Explain Multiple stacks ?


View

Explain Ackermann function in details ?


View

Explain briefly Infix expression, Polish Notation and Reverse Polish Notation ?


View

Explain about Implementation of Queue ? 


View

Define Queue. Explain Applications of Queue ? 


View

Explain simple queue ? Brief disadvantages of simple queue.


View

Define stacks. Explain various operation of stacks ? 


View