# What is a recursive Algorithm

What is a recursive Algorithm?
Recursion is made up of smaller versions of itself and a recursive algorithm calls on itself to solve problems this can be directly or an indirect call (Eck, 2017). Professors Cormen and Balkcom (n.d.) from Khan Academy put it in a great way…its like Russian nesting dolls. It’s using itself, within itself, but a smaller version of itself, until you get to the smallest version that you can’t break apart anymore.
It can be more powerful than iteration, when used appropriately.
In its history, its something that stems from mathematics, so its something that’s been around forever. Which makes it a little easier to grasp when you think about it mathematically.
Another reason that I noticed as an advantage, is that it’s a cleaner code to use recursion over something else. As its calling something from within itself, there is less code to write. It also, allows you to keep it cleaner when you are writing your pseudo code by allowing you to break it into pieces to solve. Now granted, I haven’t used it enough to know if a cleaner code is consistently correct, but from what I saw, personally it is.
A simple example is that of a factorial:
On paper or math, it would look like this:
5! = 5x4x3x2x1
N! = nX(n-1)x(n-2)x(n-3)…until you get to the smallest # of itself, which in this case is 1.
Normally we would code this using a loop, something that looks like this snippet:

An example of this, where in code it calls itself is

We Will Write a Custom Essay Specifically
For You For Only \$13.90/page!

order now