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

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

9 Super Useful Tricks for JavaScript Developers

You should know this topics for becoming a JavaScript Developer.

CRUD WITH VANILLA JAVASCRIPT

Node JS Server with Express framework

Build an Ethereum DApp Using Ethers.js

ionBooking 2 — Ionic 5 Hotel Booking Theme

Setup a Micro Frontend Architecture With Vue and single-spa

Person stacking colorful blocks on top of each other.

Performance Testing with JMeter

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
Smith Flores

Smith Flores

More from Medium

Cue the Vitamin C — Graduation (Friends Forever) Song!

Laptop wearing a graduation hat

C++ Program to find all prime numbers from 0 up to a given number N

Add Two Linked List Numbers

Version control learning