Recursion !

What is recursion?

Recursion is called a process by which a function calls itself repeatedly, until a certain condition is satisfied, if there is no specific case that terminates the recursion, an infinite loop could be created.

Example:

Calculate the power of a number using recursion:

Now let’s see how this would look step by step using stack and LIFO method:

Final result = 25

I hope you enjoyed reading this blog and learned what you need to know about recursion

A dream doesn’t magically come true, it takes sweat, determination and hard work — Colin Powell

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store