Recursion Concept with Example

What is recursion and how to use recursion in programming. If you are new to programming, then recursion concept is tough to understand. In this post, i’ll explain the concept of recursion with example.

What is Recursion ?

In Recursion, function call itself repeatedly, until the base condition is reached.  It’s a much preferred way to write cleaner and shorter code for many complex problems.

Through recursion, you can reduce complex problem into smaller version.

Recursion Objective Questions for Practice.

Recursion vs iteration

Subscribe Our Tutorials

Get Latest Updates on Facebook

Implement Binary Search Algorithm using Recursion.

Explanation of Recursion with Example

i) Factorial problem using recursion

Let’s say, you have passed 0 in factorial function in that case first condition is met and it returns 1.

Now let’s check how it work when 5 is enter .

Program to print Fibonacci series using recursion

Reverse a linked list using recursion

What happens if base condition is not defined in recursive programs.

In that case program will run until the system get out of memory.


About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged , . Bookmark the permalink.
  • Ankit

    Thank you. Can you write Fibannoci problem also using recursion.

  • lhamo

    Program which can be solved using recursion not by iteration